Skip to content

Commit 830789b

Browse files
committed
Fix Class "Doctrine\ORM\Query\Expr" not found error
1 parent 6c7d28a commit 830789b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Type/Doctrine/QueryBuilder/Expr/NewExprDynamicReturnTypeExtension.php

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use PHPStan\Type\DynamicStaticMethodReturnTypeExtension;
1414
use PHPStan\Type\ObjectType;
1515
use PHPStan\Type\Type;
16+
use function class_exists;
1617

1718
class NewExprDynamicReturnTypeExtension implements DynamicStaticMethodReturnTypeExtension, BrokerAwareExtension
1819
{
@@ -61,6 +62,10 @@ public function getTypeFromStaticMethodCall(MethodReflection $methodReflection,
6162
return new ObjectType($className);
6263
}
6364

65+
if (!class_exists($className)) {
66+
return new ObjectType($className);
67+
}
68+
6469
try {
6570
$exprObject = new $className(
6671
...$this->argumentsProcessor->processArgs(

0 commit comments

Comments
 (0)