File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed
src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator
tests/ProxyManagerTest/Functional Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,10 @@ class NullObjectMethodInterceptor extends MethodGenerator
1919 */
2020 public static function generateMethod (MethodReflection $ originalMethod ): self
2121 {
22- $ method = static ::fromReflectionWithoutBodyAndDocBlock ($ originalMethod );
23- $ originalReturnType = $ originalMethod ->getReturnType ();
22+ $ method = static ::fromReflectionWithoutBodyAndDocBlock ($ originalMethod );
2423
25- if ($ originalReturnType instanceof ReflectionNamedType && $ originalReturnType ->getName () === 'never ' ) {
26- $ method ->setBody ('throw new \Exception(); ' );
27- } elseif ($ originalMethod ->returnsReference ()) {
24+ if ($ originalMethod ->returnsReference ()) {
2825 $ reference = IdentifierSuffixer::getIdentifier ('ref ' );
29-
3026 $ method ->setBody ("\$reference = null; \nreturn \$" . $ reference . '; ' );
3127 }
3228
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ public function testNeverReturningMethodCalls(): void
145145 self ::assertIsCallable ($ method );
146146
147147 $ this ->expectException (Throwable::class);
148- $ this ->expectExceptionMessage ('' );
148+ $ this ->expectExceptionMessage ('never-returning function must not implicitly return ' );
149149 $ method (random_int (10 , 1000 ));
150150 }
151151
You can’t perform that action at this time.
0 commit comments