Skip to content

Commit 6aa0179

Browse files
dktappsondrejmirtes
authored andcommitted
CleaningVisitor: retain @phpstan-var and @psalm-var
1 parent 9e31bbf commit 6aa0179

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Parser/CleaningVisitor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ private function keepVariadicsAndYieldsAndInlineVars(array $stmts): array
5151
return in_array($node->name->toLowerString(), ParametersAcceptor::VARIADIC_FUNCTIONS, true);
5252
}
5353
if ($node instanceof Node\Stmt && $node->getDocComment() !== null) {
54-
return strpos($node->getDocComment()->getText(), '@var') !== false;
54+
foreach (['phpstan-', 'psalm-', ''] as $tagPrefix) {
55+
if (strpos($node->getDocComment()->getText(), '@' . $tagPrefix . 'var') !== false) {
56+
return true;
57+
}
58+
}
5559
}
5660

5761
return false;

0 commit comments

Comments
 (0)