Skip to content

Commit f4ee4c4

Browse files
committed
fix with check ShortenedObjectType
1 parent 5ac198c commit f4ee4c4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

rules/NetteToSymfony/NodeAnalyzer/NetteControlFactoryInterfaceAnalyzer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\Type\ObjectType;
99
use PHPStan\Type\TypeWithClassName;
1010
use PHPStan\Type\UnionType;
11+
use Rector\StaticTypeMapper\ValueObject\Type\ShortenedObjectType;
1112
use Rector\TypeDeclaration\TypeInferer\ReturnTypeInferer;
1213

1314
final class NetteControlFactoryInterfaceAnalyzer
@@ -38,7 +39,13 @@ public function isComponentFactoryInterface(Interface_ $interface): bool
3839
new ObjectType('Nette\Application\UI\Form'),
3940
]);
4041

41-
return $controlOrForm->isSuperTypeOf($returnType)->yes();
42+
if ($returnType instanceof ShortenedObjectType) {
43+
$returnType = new ObjectType($returnType->getFullyQualifiedName());
44+
}
45+
46+
if ($controlOrForm->isSuperTypeOf($returnType)->yes()) {
47+
return true;
48+
}
4249
}
4350

4451
return false;

0 commit comments

Comments
 (0)