Skip to content

Commit

Permalink
NodeTypeResolver: cheap checks first in isObjectTypeOfObjectType() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 16, 2023
1 parent 4f6de3f commit 34e1cf1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/NodeTypeResolver/NodeTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,11 @@ private function resolveByNodeTypeResolvers(Node $node): ?Type

private function isObjectTypeOfObjectType(ObjectType $resolvedObjectType, ObjectType $requiredObjectType): bool
{
if ($resolvedObjectType->isInstanceOf($requiredObjectType->getClassName())->yes()) {
if ($resolvedObjectType->getClassName() === $requiredObjectType->getClassName()) {
return true;
}

if ($resolvedObjectType->getClassName() === $requiredObjectType->getClassName()) {
if ($resolvedObjectType->isInstanceOf($requiredObjectType->getClassName())->yes()) {
return true;
}

Expand Down

0 comments on commit 34e1cf1

Please sign in to comment.