-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip removing Psalm PhpDocTagNode #1829
Conversation
Psalm allows prefixing of tags. Usually these would provide refinement on top of the type so should not be removed
Hi, I cherry-picked your test case and tried to fix it. |
@samsonasik I changed to totally ignore psalm prefixed annotations because it's most time not intended to remove. What do you think about this change? |
@@ -305,7 +305,7 @@ public function removeByType(string $typeToRemove): void | |||
$typeToRemove | |||
): ?int { | |||
if ($node instanceof PhpDocTagNode && is_a($node->value, $typeToRemove, true)) { | |||
if ($typeToRemove === VarTagValueNode::class && $node->name !== '@var') { | |||
if (str_starts_with($node->name, '@psalm-')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also skip "phpstan-" prefixed ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I looked into https://github.com/phpstan/phpdoc-parser/blob/d5a6692b8a74aeb00cc25e144f37a35da2bc31de/src/Parser/PhpDocParser.php#L121-L206
and decided to add "phpstan-" prefix too.
ff364ec
to
af06eb8
Compare
closes #1799