diff --git a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php index 83cf04943c5..473b4d5cffe 100644 --- a/src/Type/Php/MethodExistsTypeSpecifyingExtension.php +++ b/src/Type/Php/MethodExistsTypeSpecifyingExtension.php @@ -53,7 +53,7 @@ public function specifyTypes( } $objectType = $scope->getType($node->getArgs()[0]->value); - if (!$objectType instanceof ObjectType) { + if ($objectType->isString()->yes()) { if ($objectType instanceof ConstantStringType && $objectType->isClassString()) { return $this->typeSpecifier->create( $node->getArgs()[0]->value, @@ -66,9 +66,8 @@ public function specifyTypes( $scope, ); } - if ($objectType->isString()->yes()) { - return new SpecifiedTypes([], []); - } + + return new SpecifiedTypes([], []); } return $this->typeSpecifier->create(