-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Class bracing sniffs with PER 2.0 #566
Comments
@rikvdh Would you mind adding the specific rule in PER which you're trying to address ? That should make it more straight forward to figure out what the best solution direction will be. |
Thank you. I've updated the issue. While thinking about this, having a configuration option for both sniffs to disable/enable this behavior is the most compatible way I think and is not very hard to implement. |
@rikvdh My current thinking on this is as follows:
Does that align with what you had in mind ? |
As I'm working on the implementation of PER2.0 I'm facing some issues with some sniffs.
In the first introductory of section 4 of PER 2.0 it states:
For this this issue, specifically:
PSR2.Classes.ClassDeclaration.OpenBraceNewLine
andSquiz.WhiteSpace.ScopeClosingBrace.ContentBefore
have an effect.PSR2.Classes.ClassDeclaration.OpenBraceNewLine
This is for PER 2.0 'not always' valid anymore. When the closing brace is adjacent to the opening brace, it needs to not be on a newline. To check this in this sniff might be odd since it is not related to PSR2. But I would like some option to 'disable' specific cases for this error.
We could also make a new sniff where we inherit this one and extend it for PER2.0?
We should discuss the desired solution for this.
Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
This is a difficult sniff for PER 2.0. Since closing braces do not need to be on a line by itself when the opening-brace is adjacent to the left AND for only functions, methods and classes.
The easiest fix for PER2.0 might be to have an option to this sniff to disable this error when a opening brace is adjacent on the left. The openbrace sniffs might catch the cases where the 'closing brace is not allowed there' and then we omit this rule for these situations.
@jrfnl Combining 2 sniffs in one issue feels a bit odd I think, but it is related to one section of PER 2.0. Let me know if you rather like '1 sniff discussion' per issue.
The text was updated successfully, but these errors were encountered: