diff --git a/rules/NetteToSymfony/NodeAnalyzer/NetteControlFactoryInterfaceAnalyzer.php b/rules/NetteToSymfony/NodeAnalyzer/NetteControlFactoryInterfaceAnalyzer.php index 3950cb34e023..82ed4261cda1 100644 --- a/rules/NetteToSymfony/NodeAnalyzer/NetteControlFactoryInterfaceAnalyzer.php +++ b/rules/NetteToSymfony/NodeAnalyzer/NetteControlFactoryInterfaceAnalyzer.php @@ -8,6 +8,7 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\TypeWithClassName; use PHPStan\Type\UnionType; +use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType; use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer; final class NetteControlFactoryInterfaceAnalyzer @@ -38,7 +39,13 @@ public function isComponentFactoryInterface(Interface_ $interface): bool new ObjectType('Nette\Application\UI\Form'), ]); - return $controlOrForm->isSuperTypeOf($returnType)->yes(); + if ($returnType instanceof ShortenedObjectType) { + $returnType = new ObjectType($returnType->getFullyQualifiedName()); + } + + if ($controlOrForm->isSuperTypeOf($returnType)->yes()) { + return true; + } } return false;