Skip to content
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

Merged
merged 5 commits into from
Feb 18, 2022

Conversation

rajyan
Copy link
Contributor

@rajyan rajyan commented Feb 17, 2022

closes #1799

leighman and others added 3 commits February 18, 2022 00:10
Psalm allows prefixing of tags. Usually these would provide refinement on top of the type so should not be removed
@rajyan rajyan marked this pull request as ready for review February 17, 2022 16:07
@rajyan
Copy link
Contributor Author

rajyan commented Feb 17, 2022

@leighman

Hi, I cherry-picked your test case and tried to fix it.

@rajyan
Copy link
Contributor Author

rajyan commented Feb 17, 2022

@samsonasik
39edeb3
This is a similar situation to this commit.

I changed to totally ignore psalm prefixed annotations because it's most time not intended to remove. What do you think about this change?

@rajyan rajyan changed the title Feature/psalm return type Ignore removing psalm Feb 17, 2022
@rajyan rajyan changed the title Ignore removing psalm Ignore removing Psalm PhpDocTagNode Feb 17, 2022
@rajyan rajyan changed the title Ignore removing Psalm PhpDocTagNode Skip removing Psalm PhpDocTagNode Feb 17, 2022
@@ -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-')) {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajyan rajyan force-pushed the feature/psalm-return-type branch from ff364ec to af06eb8 Compare February 18, 2022 01:00
@samsonasik samsonasik merged commit 323be2a into rectorphp:main Feb 18, 2022
@samsonasik
Copy link
Member

Thank you @rajyan @staabm

@rajyan rajyan deleted the feature/psalm-return-type branch February 18, 2022 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants