diff --git a/rules-tests/DeadCode/Rector/Property/RemoveUselessVarTagRector/Fixture/with_alias.php.inc b/rules-tests/DeadCode/Rector/Property/RemoveUselessVarTagRector/Fixture/with_alias.php.inc new file mode 100644 index 00000000000..3501c1e1f6c --- /dev/null +++ b/rules-tests/DeadCode/Rector/Property/RemoveUselessVarTagRector/Fixture/with_alias.php.inc @@ -0,0 +1,32 @@ + +----- + diff --git a/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php index 6cdfd81d3a8..ad4d00048c5 100644 --- a/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadVarTagValueNodeAnalyzer.php @@ -84,6 +84,10 @@ public function isDead(VarTagValueNode $varTagValueNode, Property|ClassConst|Exp } if ($propertyType instanceof ObjectType && $docType instanceof ObjectType) { + if ($docType->equals($propertyType)) { + return true; + } + // more specific type is already in the property return $docType->isSuperTypeOf($propertyType) ->yes();