Skip to content

Commit 70c71fe

Browse files
committed
Address deprecation of ReflectionType::getClass().
1 parent 5e96f83 commit 70c71fe

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Compiler/AutowirePass.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,16 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method)
525525
$methodArgumentsMetadata = [];
526526
foreach ($method->getParameters() as $parameter) {
527527
try {
528-
$class = $parameter->getClass();
528+
if (method_exists($parameter, 'getType')) {
529+
$type = $parameter->getType();
530+
if ($type && !$type->isBuiltin()) {
531+
$class = new \ReflectionClass(method_exists($type, 'getName') ? $type->getName() : (string) $type);
532+
} else {
533+
$class = null;
534+
}
535+
} else {
536+
$class = $parameter->getClass();
537+
}
529538
} catch (\ReflectionException $e) {
530539
// type-hint is against a non-existent class
531540
$class = false;

0 commit comments

Comments
 (0)