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
[Downgrade PHP 7.3] Trailing commas in function calls #4273
[Downgrade PHP 7.3] Trailing commas in function calls #4273
Conversation
0123b42
to
99b5e0c
Compare
99b5e0c
to
31d7749
Compare
31d7749
to
bf0dcf7
Compare
After some digging I can conclude that this is not possible using php-parser because php-parser isn't aware of the trailing comma AFAIK. |
I came to similar conslussion when PHP 7.3 was released. Maybe php-cs-fixer is better for this job |
So is including php-cs-fixer as a dependency an option? It would be nice if rectorphp makes downgrading every php version possible. |
Triggering regeneration removes the trailing commas. The only side effect I'm aware of is that when having a method call inline in a string in a method call, the curly brackets are doubled.
Makes
results in
A possible workaround could be
But the trailing comma isn't removed then. |
122eeb9
to
838d315
Compare
Removing original node usually lead to reprint without format. Then it depends on default printer setting. What could work is do is hack around |
838d315
to
4f0a8a8
Compare
With this one I am waiting for nikic/PHP-Parser#732. |
f24d0b0
to
5846e21
Compare
5846e21
to
b245d36
Compare
b245d36
to
369fc93
Compare
369fc93
to
0c39734
Compare
@TomasVotruba updating nikic/phpparser doesn't seem sufficient, do I need to wait for phpstan to include the latest phpparser or am I missing something? |
I'll look into this |
These 2 last details are ok. Do not change the code meaning and solves the comma. Merged in: #4796 Thank you 👍 |
rectorphp/rector-src@3806bb8 [NodeManipulator] Reduce parent lookup on PropertyManipulator under Unset_ (#4273)
#4168