PSR2 WrongOpenercase with colon and bracket is unclear#1358
Conversation
jrfnl
left a comment
There was a problem hiding this comment.
@bigdevlarry Thanks for opening this PR, but it doesn't correctly address the issue.
- The PR as-is presumes this is a block with a colon + curly braces, but doesn't verify it, so there could be a situation where the error message would be shown when there are no curlies, making this a worse situation than before.
- The error code change is effectively a breaking change as it will break any ignore annotations referencing the original code, as well as ruleset directives referencing the original code.
As things are, I cannot accept this PR.
|
Hey @jrfnl , thanks for the feedback. I've added a check, and also is there a reasoning for the failing test? |
There was a problem hiding this comment.
I've added a check
@bigdevlarry Thanks for that, but it looks like you did not (manually) test this change as the code is not working the way you intended it to.
See the code coverage report which shows the code never gets run: https://coveralls.io/builds/77252487/source?filename=src%2FStandards%2FPSR2%2FSniffs%2FControlStructures%2FSwitchDeclarationSniff.php
Also the error code change is still a blocker.
also is there a reasoning for the failing test?
Rate limit if the broken link check is executed too frequently ;-)
c04c633 to
b7cba75
Compare
|
@jrfnl Helpful feedback again; I've now improved the conditional, did some manual test and test coverage should report nicely now :) |
jrfnl
left a comment
There was a problem hiding this comment.
@bigdevlarry Thanks for the update. Not trying to be difficult, but can I please ask you to take another critical look at the code ?
Aside from the inline comments, as I've already previously pointed out, the change in the error code is a breaking change. Please justify why this should have a different error code.
Lastly, unless you can - in all honesty - place a checkmark in the third checkbox in the PR template granting the project the rights to the code, I will not be able to accept the PR.
…nd bracket is unclear
430015d to
7c06a1d
Compare
jrfnl
left a comment
There was a problem hiding this comment.
@bigdevlarry Thank you for those changes. All good now. Thank you for contributing.
Updated SwitchDeclarationSniff to give a clear error when a case uses a braced block after the colon.
Description
The PR introduces a change that correct updates the SwitchDeclarationSniff to give a clear error when a case uses a braced block after the colon.
Suggested changelog entry
Improved PSR2 SwitchDeclaration sniff to detect and report case/default statements using a braced block after the colon with (
CaseWithBlockScope)Related issues/external references
Fixes #1322
Types of changes
PR checklist