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

Merged
merged 1 commit into from
Feb 18, 2020
Merged

BracesFixer - fix invalid code generation on alternative syntax #4813

merged 1 commit into from
Feb 18, 2020

Conversation

SpacePossum
Copy link
Contributor

@SpacePossum 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 Ready To Merge label Feb 14, 2020
@kubawerlos
Copy link
Contributor

What about switch? It also can use alternative syntax.

@SpacePossum
Copy link
Contributor 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

SpacePossum added a commit that referenced this pull request Feb 18, 2020
…ntax (SpacePossum)

This PR was squashed before being merged into the 2.15 branch (closes #4813).

Discussion
----------

BracesFixer - fix invalid code generation on alternative syntax

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)

Commits
-------

fd5a1cf BracesFixer - fix invalid code generation on alternative syntax
@SpacePossum SpacePossum merged commit fd5a1cf into PHP-CS-Fixer:2.15 Feb 18, 2020
@SpacePossum SpacePossum removed the RTM Ready To Merge label Feb 18, 2020
@SpacePossum SpacePossum deleted the 2_15_braces_4811 branch February 18, 2020 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants