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

Support @phan- prefixes on recognized phpdoc tags #3000

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

anomiex
Copy link
Contributor

@anomiex anomiex commented Apr 3, 2024

Per request at phpstan/phpdoc-parser#235 (comment)

Hopefully I added the right tests in the right places, mostly I grepped for "psalm" then tried to add similar tests. Feel free to update the PR if necessary.

@ondrejmirtes
Copy link
Member

The implementation is wrong. You should test what happens which prefix has priority if more of them are present. @phpstan- should always win.

@anomiex
Copy link
Contributor Author

anomiex commented Apr 3, 2024

I just copied what seemed to be being done for @psalm-, for which the only place I saw priority logic is in PhpDocNodeResolver::resolveTemplateTags(), for which I put @phan- at a lower priority than both @psalm- and @phpstan-. The test case here seems to confirm that.

As I mentioned, feel free to update the PR. Or, if you want to point out specific test cases where @phan- is overriding @phpstan- (and where existing @psalm- doesn't have the same problem), I'll try to take a look when I have time.

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

InvalidPhpDocTagValueRule needs to ignore @phan- tags, same as it ignores @psalm-.

@ondrejmirtes ondrejmirtes merged commit dda4675 into phpstan:1.11.x Apr 5, 2024
442 of 445 checks passed
@ondrejmirtes
Copy link
Member

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants