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
NativeConstantInvocationFixer - better constant detection #3823
Conversation
61d03f8
to
78e60bf
Compare
how about these as well than ;) yield M_PI;
yield M_PI => M_PI; |
@SpacePossum The check is done like this: "All T_STRING tokens are constant invocations, except those matching these conditions...". But of course it is good to have also different test cases for the actual constant invocations, so I will add your test case! 👍 |
👍 |
Shouldn't the new test cases also be added to the fixer's test, so refactoring TokenAnalyzer in the future will not mess up the specific fixer? |
Indeed, they should be added to the fixer's test too. |
6f59526
to
a8a4ef2
Compare
Thanks @gharlan. |
…gharlan, SpacePossum, keradus) This PR was squashed before being merged into the 2.12 branch (closes #3823). Discussion ---------- NativeConstantInvocationFixer - better constant detection Some previous failing test cases: ```php M_PI::foo(); function foo(M_PI $a) {} function foo(): M_PI {} $foo instanceof M_PI; class x implements FOO, BAR, BAZ {} use X\Y\{FOO, BAR as BAR2, BAZ}; class Foo { use Bar, M_PI { Bar::baz insteadof M_PI; } } M_PI: goto M_PI; // ;) ``` Commits ------- a8a4ef2 NativeConstantInvocationFixer - better constant detection
Some previous failing test cases: