77use Exception ;
88use InvalidArgumentException ;
99use PHPUnit \Framework \TestCase ;
10+ use Throwable ;
11+ use function fopen ;
12+ use function serialize ;
13+ use function unserialize ;
1014
1115/**
1216 * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag
@@ -38,17 +42,17 @@ public function testCreationWithError() : void
3842
3943 self ::assertSame ('name ' , $ tag ->getName ());
4044 self ::assertSame ('@name Body ' , $ tag ->render ());
41- self ::assertSame ('Body ' , (string )$ tag );
45+ self ::assertSame ('Body ' , (string ) $ tag );
4246 self ::assertSame ($ exception , $ tag ->getException ());
4347 }
4448
4549 public function testCreationWithErrorContainingClosure () : void
4650 {
4751 try {
4852 $ this ->throwExceptionFromClosureWithClosureArgument ();
49- } catch (Exception $ e ) {
53+ } catch (Throwable $ e ) {
5054 $ parentException = new Exception ('test ' , 0 , $ e );
51- $ tag = InvalidTag::create ('Body ' , 'name ' )->withError ($ parentException );
55+ $ tag = InvalidTag::create ('Body ' , 'name ' )->withError ($ parentException );
5256 self ::assertSame ('name ' , $ tag ->getName ());
5357 self ::assertSame ('@name Body ' , $ tag ->render ());
5458 self ::assertSame ($ parentException , $ tag ->getException ());
@@ -58,36 +62,36 @@ public function testCreationWithErrorContainingClosure() : void
5862 }
5963 }
6064
61- private function throwExceptionFromClosureWithClosureArgument ()
65+ private function throwExceptionFromClosureWithClosureArgument () : void
6266 {
63- $ function = function () {
67+ $ function = static function () : void {
6468 throw new InvalidArgumentException ();
6569 };
6670
6771 $ function ($ function );
6872 }
6973
70- public function testCreationWithErrorContainingResource ()
74+ public function testCreationWithErrorContainingResource () : void
7175 {
7276 try {
7377 $ this ->throwExceptionWithResourceArgument ();
74- } catch (Exception $ e ) {
78+ } catch (Throwable $ e ) {
7579 $ parentException = new Exception ('test ' , 0 , $ e );
76- $ tag = InvalidTag::create ('Body ' , 'name ' )->withError ($ parentException );
80+ $ tag = InvalidTag::create ('Body ' , 'name ' )->withError ($ parentException );
7781 self ::assertSame ('name ' , $ tag ->getName ());
7882 self ::assertSame ('@name Body ' , $ tag ->render ());
7983 self ::assertSame ($ parentException , $ tag ->getException ());
8084 self ::assertStringStartsWith (
8185 'resource(stream) ' ,
82- $ tag ->getException ()->getPrevious ()->getTrace ()[0 ]['args ' ][0 ])
83- ;
86+ $ tag ->getException ()->getPrevious ()->getTrace ()[0 ]['args ' ][0 ]
87+ ) ;
8488 self ::assertEquals ($ parentException , unserialize (serialize ($ parentException )));
8589 }
8690 }
8791
88- private function throwExceptionWithResourceArgument ()
92+ private function throwExceptionWithResourceArgument () : void
8993 {
90- $ function = function () {
94+ $ function = static function () : void {
9195 throw new InvalidArgumentException ();
9296 };
9397
0 commit comments