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

[DX] Add StmtsAwareInterface to catch node by type #2269

Merged
merged 3 commits into from
May 8, 2022

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented May 8, 2022

@todo consider proposing directly to php-parser to ease the node traversing

@todo move to to allow in Rector extensions https://github.com/rectorphp/vendor-patches

@TomasVotruba TomasVotruba changed the title add StmtsAwareInterface to catch node by type [DX] Add StmtsAwareInterface to catch node by type May 8, 2022
@TomasVotruba TomasVotruba force-pushed the tv-stmts-aware-interface branch 7 times, most recently from 5aa2f28 to bdeb97c Compare May 8, 2022 18:09
Copy link
Contributor

@staabm staabm left a comment

Choose a reason for hiding this comment

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

Looks great.

Might it lead to incompatibilities with phpstan, which is not aware of such a patched PHPParser?

@TomasVotruba
Copy link
Member Author

I thought of that and it's just a marker interface, with no logic nor methods, so should be ok. The stmts property always exists on those nodes. CI is passing as well.

@staabm
Copy link
Contributor

staabm commented May 8, 2022

Turned differently: Might it lead to problems when running rector in tandem with something bundling PHPParser (e.g. phpstan) and autoloading will not load the patched PHPParser classes shipped with rector, but different ones..?

Do we need to make sure, rector is working with the patched PHPParser version?

@TomasVotruba
Copy link
Member Author

The rule would have to specifically require it. I'll update the patch paths and we can test it out 👍

@TomasVotruba
Copy link
Member Author

@TomasVotruba TomasVotruba enabled auto-merge (squash) May 8, 2022 20:47
@TomasVotruba TomasVotruba merged commit 975fdf1 into main May 8, 2022
@TomasVotruba TomasVotruba deleted the tv-stmts-aware-interface branch May 8, 2022 20:50
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