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

BracesFixer - fix invalid code generation on alternative syntax #4813

Open
wants to merge 2 commits into
base: 2.15
from

Conversation

@SpacePossum
Copy link
Member

SpacePossum commented Feb 14, 2020

Fixes #4811

Basically this skips some edge cases when using alternative syntax. For now I don't want to add a lot of logic to support this case fully as we are splitting this fixer in the future anyway. Secondly we don't support alternative syntax in a lot of cases in the project.

For those interested; BracesFixer::findStatementEnd doesn't find the correct index for some of the alternative syntax expressions (see utests)

@SpacePossum SpacePossum added this to the 2.15.6 milestone Feb 14, 2020
@SpacePossum SpacePossum added the RTM label Feb 14, 2020
@kubawerlos

This comment has been minimized.

Copy link
Contributor

kubawerlos commented Feb 15, 2020

What about switch? It also can use alternative syntax.

@SpacePossum

This comment has been minimized.

Copy link
Member Author

SpacePossum commented Feb 15, 2020

it is here; https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4813/files#diff-6ee2b7ebb0faee78657d4e8d3fb3e10dR5313 but happy to add more tests!

good find, thanks! code and tests updated

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.