Skip to content

Commit 3f89598

Browse files
committed
Fix ClassRegistryInit doesn't work with ClassConstFetch AST
1 parent 1613b9f commit 3f89598

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ClassRegistryInitExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use PhpParser\Node\Expr\ClassConstFetch;
88
use PhpParser\Node\Name;
9+
use PhpParser\Node\Scalar\String_;
910
use PHPStanCakePHP2\Service\SchemaService;
1011
use Inflector;
1112
use PhpParser\ConstExprEvaluator;
@@ -49,8 +50,8 @@ public function getTypeFromStaticMethodCall(MethodReflection $methodReflection,
4950
$value = $methodCall->getArgs()[0]->value;
5051
$evaluator = new ConstExprEvaluator();
5152

52-
if ($value instanceof ClassConstFetch && $value->class instanceof Name) {
53-
$value = $value->class->toString();
53+
if ($value instanceof ClassConstFetch && $value->class instanceof Name\FullyQualified) {
54+
$value = new String_($value->class->toString());
5455
}
5556

5657
$arg1 = $evaluator->evaluateSilently($value);

0 commit comments

Comments
 (0)