-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
LineEndingFixer - handle "\r\r\n" #4699
LineEndingFixer - handle "\r\r\n" #4699
Conversation
What about |
Even better :) |
I'm not against changes proposed here but, if I remember correcly, the current behavior (not supporting |
The problem is that the current behavior is wrong - fixer cannot leave the code that requires fixing by itself. |
Not sure if we left With the proposed changes in this PR, which users might be effected in a way that we might not want? |
@SpacePossum not sure, some that have really old piece of code I guess, I doubt anyone is using |
Can you propose the fix in the PR in a new commit? I think it will be fine TBH |
Thank you @kubawerlos. |
This PR was squashed before being merged into the 2.15 branch (closes #4699). Discussion ---------- LineEndingFixer - handle "\r\r\n" The added test is converting the input to expected, but it fails because: > Code build on input code must match expected code. We have two ways to fix it: 1. Update the RegEx `#\r\n|\n#` to `#\r+\n|\n#` 2. Update the RegEx `#\r\n|\n#` to `#\r\n|\r|\n#` and test case to: ```php $cases[] = [ "<?php echo 'foo',\n\n'bar';", "<?php echo 'foo',\r\r\n'bar';", ]; ``` Option 2 seems more right as the original `\r\r\n` is treated (at least in PHPStorm) as 2 line endings. Ping @fabpot, @SpacePossum and @keradus as authors for opinion. Commits ------- b465a72 LineEndingFixer - handle \"\r\r\n\"
The added test is converting the input to expected, but it fails because:
We have two ways to fix it:
#\r\n|\n#
to#\r+\n|\n#
#\r\n|\n#
to#\r\n|\r|\n#
and test case to:Option 2 seems more right as the original
\r\r\n
is treated (at least in PHPStorm) as 2 line endings.Ping @fabpot, @SpacePossum and @keradus as authors for opinion.