Skip to content

Commit

Permalink
[rector] Rector fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 24, 2024
1 parent 0b21e2f commit ef1ab31
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Rector\Doctrine\CodeQuality\Rector\Class_;

use PhpParser\Node\Attribute;
use PhpParser\Node;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Stmt\Class_;
Expand Down Expand Up @@ -102,13 +103,13 @@ public function refactorWithScope(Node $node, Scope $scope): ?Node

$property = $this->methodUniqueReturnedPropertyResolver->resolve($node, $classMethod);

if ($property === null) {
if (!$property instanceof Property) {
continue;
}

$collectionObjectType = $this->getCollectionObjectTypeFromToManyAttribute($property);

if ($collectionObjectType === null) {
if (!$collectionObjectType instanceof FullyQualifiedObjectType) {
return null;
}

Expand Down Expand Up @@ -153,6 +154,6 @@ private function isDoctrineEntityClass(Class_ $class): bool
['Doctrine\ORM\Mapping\Entity', 'Doctrine\ORM\Mapping\Embeddable'],
);

return $entityAttribute !== null;
return $entityAttribute instanceof Attribute;
}
}

0 comments on commit ef1ab31

Please sign in to comment.