Skip to content

Commit

Permalink
fix with check ShortenedObjectType
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Mar 19, 2021
1 parent 5bcfd98 commit ed79bce
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ed79bce

Please sign in to comment.