-
-
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
Trailing Space in a comment before the code to be fixed adds unnecessary empty line #3457
Comments
Hi and thanks for reporting, Could you share your configuration? Using the default configuration of this project on v.2.10.0 does not show the issue so it is hard to track down without knowing which rules are applied, thanks! |
Here is a test reproducing the issue dbaltas@b4ef7ea |
maybe just raise a PR with it ? |
Well, I didn't raise a PR because I am not close to suggest a fix. |
… fix when previous line has a trailing whitespace
… fix when previous line has a trailing whitespace
… fix when previous line has a trailing whitespace
I retried this on |
The issue persists in 2.12.1 steps to reproduce
logs
Above is the terminal log of creating a file /tmp/cs-fix/a.php with "the before running" version. I wouldn't expect the operating system to affect this. (I am running on MacOS 10.13.4, php 7.1.8) |
Thanks for getting back! --edit-- After digging around this seems a priority issue between; When However this does not happen when not using the rules default configuration; but it does go wrong for something like this fails (note: no config file used); so the priority issue is somewhere between the two rules and their configuration... bug-hunt continues! |
Having some code with a potential fix and a comment with a trailing space right before the code, results to an empty line being added in the fix.
If the comment has no trailing space, fixer works as expected.
The PHP version you are using (
$ php -v
):=> PHP 7.1.8
PHP CS Fixer version you are using (
$ php-cs-fixer -V
):=> 2.10.0
The command you use to run PHP CS Fixer:
=>
php-cs-fixer fix a.php
Sample PHP code (a.php):
The text was updated successfully, but these errors were encountered: