8000 Add test for `MethodNode::isDeclaration()` by phansys · Pull Request #1194 · phpmd/phpmd · GitHub
[go: up one dir, main page]

Skip to content

Add test for MethodNode::isDeclaration() #1194

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

phansys
Copy link
Contributor
@phansys phansys commented Jun 24, 2024

Type: bug report
Issue: n/a
Breaking change: no (at least, not yet)

IIUC, MethodNode::isDeclaration() is not working as expected, because methods overriding or implementing parent classes or interfaces are being interpreted as declarations.

The added test tries to expose the described issue.

@phansys
Copy link
Contributor Author
phansys commented Jun 24, 2024

Do you know if there is any init process or something else I might be missing?

I suspect that the related ASTs for the ClassNode containing the MethodNode (parent classes, interfaces) are not being built correctly, but I don't know if there is an explicit instruction or configuration for that.

@AJenbo
Copy link
Member
AJenbo commented Jun 24, 2024

i would try targeting 3.x instead, things are simpler, cleaner and you get full phpstan checks on your changes.

@phansys
Copy link
Contributor Author
phansys commented Jun 24, 2024

i would try targeting 3.x instead, things are simpler, cleaner and you get full phpstan checks on your changes.

I'll try to create a new PR against 3.x, thanks for pointing 👍
Although I think this PR should be kept for 2.x, as the described problem is affecting this version.

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

Successfully merging this pull request may close these issues.

2 participants
0