diff --git a/rules/TypeDeclaration/TypeInferer/SplArrayFixedTypeNarrower.php b/rules/TypeDeclaration/TypeInferer/SplArrayFixedTypeNarrower.php index 194fc75d8f..01987e0c35 100644 --- a/rules/TypeDeclaration/TypeInferer/SplArrayFixedTypeNarrower.php +++ b/rules/TypeDeclaration/TypeInferer/SplArrayFixedTypeNarrower.php @@ -35,6 +35,7 @@ public function narrow(Type $paramType): Type if ($className === 'PhpCsFixer\Doctrine\Annotation\Tokens') { $types[] = new ObjectType('PhpCsFixer\Doctrine\Annotation\Token'); } + return $paramType; } } diff --git a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php index 07acc2d930..4551416fd6 100644 --- a/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php +++ b/src/NodeTypeResolver/PhpDocNodeVisitor/ClassRenamePhpDocNodeVisitor.php @@ -77,6 +77,7 @@ public function enterNode(Node $node): ?Node if (! $oldType instanceof ObjectType) { continue; } + if (! $objectType->equals($oldType)) { continue; }