-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
BracesFixer - handle comment for content outside of given block #3359
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
Conversation
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
This PR was squashed before being merged into the 2.7 branch (closes #25653). Discussion ---------- PHP CS Fixer: clean up repo and adjust config | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | n/a | Fixed tickets | n/a | License | MIT | Doc PR | n/a Reason for this PR is that one want to have `php-cs-fixer fix -v` command executed without changes that shall not be applied for this repo. To achieve that, we need to groom config to exclude files that violate CS willingly, fix files that are violating CS unwillingly, and deliver missing case handling at PHP CS Fixer itself (PHP-CS-Fixer/PHP-CS-Fixer#3359) (already merged!). Commits ------- b14cbc1 PHP CS Fixer: clean up repo and adjust config
@keradus, I'm seeing some odd behavior in the latest php-cs-fixer release that seems to be related to this PR. If I have a series of comments inside an if..else, the first one gets de-indented. So, for example, I end up with something like this: if ($condition) { echo "This is code."; // This is the first line of comments // This is the second line of comments } else { echo "This is different code."; } This isn't really causing major problems for me, but it seems like it is not the desired behavior, so I thought you might be interested to know. Please let me know if you would like any additional information. |
2nd commend shall be de-indented as well, as those multiple T_COMMENT are one comment for dev. Would you mind to send a PR ? |
@keradus, it may take me a little while to find time to put together a PR, but I will try to do so. Thanks! |
Thanks, I would appreciate that ! |
@keradus, I wanted to start by creating a test case to demonstrate the problem, and to this end I began trying to find a way to set up an example of my problem in BracesFixerTest. Unfortunately, I don't think I understand exactly what all these arrays of examples are supposed to do, and I ran out of time before achieving success. Do you have any pointers on a place in the test suite where I can simply provide input and expected output in order to begin this project? |
Sure @demiankatz Now, I can see that we didn't properly handle this PR. Test scenarios we have added are having expected values, but not input ones (only one element in array). |
Thanks, @keradus, that is extremely helpful. I was able to create a failing test here: Not sure if I'm qualified to actually fix the bug, though -- I've been poking at the code a bit, but it's quite complex, and I'm not sure if this problem is going to require a small tweak or a more significant rewrite. I welcome advice if you're willing to share. In any case, thanks for your time so far! |
you welcome ;) I do agree that Your test-case looks pretty valid and I believe it nicely showing the issue we are facing now. |
No description provided.