@@ -17,29 +17,29 @@ public function shouldAcceptClosureCallbackWithTypehint()
1717 /** @test */
1818 public function shouldAcceptFunctionStringCallbackWithTypehint ()
1919 {
20- self ::assertTrue (_checkTypehint (new TestCallbackWithTypehintClass (), new InvalidArgumentException ()));
21- self ::assertFalse (_checkTypehint (new TestCallbackWithTypehintClass (), new Exception ()));
20+ self ::assertTrue (_checkTypehint (new CallbackWithTypehintClass (), new InvalidArgumentException ()));
21+ self ::assertFalse (_checkTypehint (new CallbackWithTypehintClass (), new Exception ()));
2222 }
2323
2424 /** @test */
2525 public function shouldAcceptInvokableObjectCallbackWithTypehint ()
2626 {
27- self ::assertTrue (_checkTypehint (new TestCallbackWithTypehintClass (), new InvalidArgumentException ()));
28- self ::assertFalse (_checkTypehint (new TestCallbackWithTypehintClass (), new Exception ()));
27+ self ::assertTrue (_checkTypehint (new CallbackWithTypehintClass (), new InvalidArgumentException ()));
28+ self ::assertFalse (_checkTypehint (new CallbackWithTypehintClass (), new Exception ()));
2929 }
3030
3131 /** @test */
3232 public function shouldAcceptObjectMethodCallbackWithTypehint ()
3333 {
34- self ::assertTrue (_checkTypehint ([new TestCallbackWithTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
35- self ::assertFalse (_checkTypehint ([new TestCallbackWithTypehintClass (), 'testCallback ' ], new Exception ()));
34+ self ::assertTrue (_checkTypehint ([new CallbackWithTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
35+ self ::assertFalse (_checkTypehint ([new CallbackWithTypehintClass (), 'testCallback ' ], new Exception ()));
3636 }
3737
3838 /** @test */
3939 public function shouldAcceptStaticClassCallbackWithTypehint ()
4040 {
41- self ::assertTrue (_checkTypehint ([TestCallbackWithTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
42- self ::assertFalse (_checkTypehint ([TestCallbackWithTypehintClass ::class, 'testCallbackStatic ' ], new Exception ()));
41+ self ::assertTrue (_checkTypehint ([CallbackWithTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
42+ self ::assertFalse (_checkTypehint ([CallbackWithTypehintClass ::class, 'testCallbackStatic ' ], new Exception ()));
4343 }
4444
4545 /**
@@ -61,8 +61,8 @@ public function shouldAcceptClosureCallbackWithUnionTypehint()
6161 */
6262 public function shouldAcceptInvokableObjectCallbackWithUnionTypehint ()
6363 {
64- self ::assertTrue (_checkTypehint (new TestCallbackWithUnionTypehintClass (), new InvalidArgumentException ()));
65- self ::assertFalse (_checkTypehint (new TestCallbackWithUnionTypehintClass (), new Exception ()));
64+ self ::assertTrue (_checkTypehint (new CallbackWithUnionTypehintClass (), new InvalidArgumentException ()));
65+ self ::assertFalse (_checkTypehint (new CallbackWithUnionTypehintClass (), new Exception ()));
6666 }
6767
6868 /**
@@ -71,8 +71,8 @@ public function shouldAcceptInvokableObjectCallbackWithUnionTypehint()
7171 */
7272 public function shouldAcceptObjectMethodCallbackWithUnionTypehint ()
7373 {
74- self ::assertTrue (_checkTypehint ([new TestCallbackWithUnionTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
75- self ::assertFalse (_checkTypehint ([new TestCallbackWithUnionTypehintClass (), 'testCallback ' ], new Exception ()));
74+ self ::assertTrue (_checkTypehint ([new CallbackWithUnionTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
75+ self ::assertFalse (_checkTypehint ([new CallbackWithUnionTypehintClass (), 'testCallback ' ], new Exception ()));
7676 }
7777
7878 /**
@@ -81,11 +81,11 @@ public function shouldAcceptObjectMethodCallbackWithUnionTypehint()
8181 */
8282 public function shouldAcceptStaticClassCallbackWithUnionTypehint ()
8383 {
84- self ::assertTrue (_checkTypehint ([TestCallbackWithUnionTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
85- self ::assertFalse (_checkTypehint ([TestCallbackWithUnionTypehintClass ::class, 'testCallbackStatic ' ], new Exception ()));
84+ self ::assertTrue (_checkTypehint ([CallbackWithUnionTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
85+ self ::assertFalse (_checkTypehint ([CallbackWithUnionTypehintClass ::class, 'testCallbackStatic ' ], new Exception ()));
8686 }
8787
88- /** @test */
88+ /** @test */
8989 public function shouldAcceptClosureCallbackWithoutTypehint ()
9090 {
9191 self ::assertTrue (_checkTypehint (function (InvalidArgumentException $ e ) {
@@ -95,25 +95,25 @@ public function shouldAcceptClosureCallbackWithoutTypehint()
9595 /** @test */
9696 public function shouldAcceptFunctionStringCallbackWithoutTypehint ()
9797 {
98- self ::assertTrue (_checkTypehint (new TestCallbackWithoutTypehintClass (), new InvalidArgumentException ()));
98+ self ::assertTrue (_checkTypehint (new CallbackWithoutTypehintClass (), new InvalidArgumentException ()));
9999 }
100100
101101 /** @test */
102102 public function shouldAcceptInvokableObjectCallbackWithoutTypehint ()
103103 {
104- self ::assertTrue (_checkTypehint (new TestCallbackWithoutTypehintClass (), new InvalidArgumentException ()));
104+ self ::assertTrue (_checkTypehint (new CallbackWithoutTypehintClass (), new InvalidArgumentException ()));
105105 }
106106
107107 /** @test */
108108 public function shouldAcceptObjectMethodCallbackWithoutTypehint ()
109109 {
110- self ::assertTrue (_checkTypehint ([new TestCallbackWithoutTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
110+ self ::assertTrue (_checkTypehint ([new CallbackWithoutTypehintClass (), 'testCallback ' ], new InvalidArgumentException ()));
111111 }
112112
113113 /** @test */
114114 public function shouldAcceptStaticClassCallbackWithoutTypehint ()
115115 {
116- self ::assertTrue (_checkTypehint ([TestCallbackWithoutTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
116+ self ::assertTrue (_checkTypehint ([CallbackWithoutTypehintClass ::class, 'testCallbackStatic ' ], new InvalidArgumentException ()));
117117 }
118118}
119119
@@ -124,54 +124,3 @@ function testCallbackWithTypehint(InvalidArgumentException $e)
124124function testCallbackWithoutTypehint ()
125125{
126126}
127-
128- class TestCallbackWithTypehintClass
129- {
130- public function __invoke (InvalidArgumentException $ e )
131- {
132- }
133-
134- public function testCallback (InvalidArgumentException $ e )
135- {
136- }
137-
138- public static function testCallbackStatic (InvalidArgumentException $ e )
139- {
140- }
141- }
142-
143- if (defined ('PHP_MAJOR_VERSION ' ) && (PHP_MAJOR_VERSION >= 8 )) {
144- eval (<<<EOT
145- namespace React\Promise;
146- class TestCallbackWithUnionTypehintClass
147- {
148- public function __invoke(\RuntimeException|\InvalidArgumentException \$e)
149- {
150- }
151-
152- public function testCallback(\RuntimeException|\InvalidArgumentException \$e)
153- {
154- }
155-
156- public static function testCallbackStatic(\RuntimeException|\InvalidArgumentException \$e)
157- {
158- }
159- }
160- EOT
161- );
162- }
163-
164- class TestCallbackWithoutTypehintClass
165- {
166- public function __invoke ()
167- {
168- }
169-
170- public function testCallback ()
171- {
172- }
173-
174- public static function testCallbackStatic ()
175- {
176- }
177- }
0 commit comments