Skip to content

Commit

Permalink
Get rid of instanceof TypeWithClassName in ApiInstanceofRule
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm authored and ondrejmirtes committed Jan 16, 2023
1 parent 1c6deb1 commit a30e267
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Rules/Api/ApiInstanceofRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType;
use function count;
use function sprintf;
Expand Down Expand Up @@ -94,7 +93,7 @@ private function processCoveredClass(Node\Expr\Instanceof_ $node, Scope $scope,
$exprType = $scope->getType($node->expr);
if ($exprType instanceof UnionType) {
foreach ($exprType->getTypes() as $innerType) {
if ($innerType instanceof TypeWithClassName && $classType->isSuperTypeOf($innerType)->yes()) {
if ($innerType->getObjectClassNames() !== [] && $classType->isSuperTypeOf($innerType)->yes()) {
return [];
}
}
Expand Down

0 comments on commit a30e267

Please sign in to comment.