Skip to content

Commit dca997c

Browse files
committed
Extraca reflection to separate method
1 parent 465a093 commit dca997c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Reflection/ObjectBehaviorMethodsClassReflectionExtension.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
6666
$srcClassReflection = $this->broker->getClass($resources[0]->getSrcClassname());
6767

6868
$method = $srcClassReflection->getNativeMethod($methodName);
69+
$this->replaceReturnType($method);
6970

71+
return $method;
72+
}
73+
74+
private function replaceReturnType(MethodReflection $method): void
75+
{
7076
$methodReflection = new \ReflectionClass($method);
7177
$returnType = $methodReflection->getProperty('nativeReturnType');
7278
$returnType->setAccessible(true);
@@ -79,7 +85,5 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
7985
$variants = $methodReflection->getProperty('variants');
8086
$variants->setAccessible(true);
8187
$variants->setValue($method, null);
82-
83-
return $method;
8488
}
8589
}

0 commit comments

Comments
 (0)