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

Incorrect auto-fixing in Generic.ControlStructures.InlineControlStructure during live coding #2989

Merged
merged 1 commit into from Sep 21, 2020

Conversation

thiemowmde
Copy link
Contributor

… a bracket

While live coding, there might not only be an incomplete if (): at the end of a file, it might as well be an incomplete if () {. The most minimal example I found is <?php if ( 1 ) { break;. The auto-fix currently turns this into <?php if ( 1 ) { { { { { { { { { { { { { { { { { { { { { { { { { { break;}}}}}}}}}}}}}}}}}}}}}}}}}. 😲

… a bracket

While live coding, there might not only be an incomplete `if ():` at the end of a file, it might as well be an incomplete `if () {`. The most minimal example I found is `<?php if ( 1 ) { break;`. The auto-fix currently turns this into `<?php if ( 1 ) { { { { { { { { { { { { { { { { { { { { { { { { { { break;}}}}}}}}}}}}}}}}}}}}}}}}}`. 😲
@thiemowmde
Copy link
Contributor Author

What's needed to get a tiny bugfix like this reviewed and merged?

@gsherwood gsherwood changed the title Fix InlineControlStructureSniff adding brackets when there is already… Incorrect auto-fixing in Generic.ControlStructures.InlineControlStructure during live coding Sep 21, 2020
@gsherwood gsherwood added this to Idea Bank in PHPCS v3 Development via automation Sep 21, 2020
@gsherwood gsherwood added this to the 3.5.7 milestone Sep 21, 2020
gsherwood added a commit that referenced this pull request Sep 21, 2020
@gsherwood gsherwood merged commit bbaf20f into squizlabs:master Sep 21, 2020
PHPCS v3 Development automation moved this from Idea Bank to Ready for Release Sep 21, 2020
@gsherwood
Copy link
Member

Auto-fixing during live coding seems a bit dangerous. Thanks for fixing this issue, but I suspect there are other lurking in the sniffs. Please let me know if you find more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PHPCS v3 Development
Ready for Release
Development

Successfully merging this pull request may close these issues.

None yet

2 participants