deadParamTagValueNodeAnalyzer = $deadParamTagValueNodeAnalyzer; $this->docBlockUpdater = $docBlockUpdater; } public function removeParamTagsIfUseless(PhpDocInfo $phpDocInfo, FunctionLike $functionLike) : bool { $hasChanged = \false; $phpDocNodeTraverser = new PhpDocNodeTraverser(); $phpDocNodeTraverser->traverseWithCallable($phpDocInfo->getPhpDocNode(), '', function (Node $docNode) use($functionLike, &$hasChanged) : ?int { if (!$docNode instanceof PhpDocTagNode) { return null; } if (!$docNode->value instanceof ParamTagValueNode) { return null; } // handle only basic types, keep phpstan/psalm helper ones if ($docNode->name !== '@param') { return null; } if (!$this->deadParamTagValueNodeAnalyzer->isDead($docNode->value, $functionLike)) { return null; } $hasChanged = \true; return PhpDocNodeTraverser::NODE_REMOVE; }); if ($hasChanged) { $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($functionLike); } return $hasChanged; } }