Replies: 1 comment
-
Hey @jrfnl -- thank you for the incredible amount of hard work on this project! I wanted to follow up on this because I spent a good chunk of the weekend trying to get this to work but just keep hitting walls. 1. Bug BehaviorAt the simplest level, the following two rules simply do not work together:
Including PSR12 always disables that Squiz rule. I cannot figure out why. There do not seem to be any conflicts when I read through the rulesets.
Does not work either. I tried many different exclusion rules, none worked. This definitely feels like it is not intended? 2. Guidance on Before/After SpacingIf I could just get the above combo working in Section 1, I'd be a happy camper and can settle for that. Additionally though I'm having a hard time believing I can't find a standard ruleset for this (spacing both after and before)? I actually spent an hour or two trying to simply write my own Sniff, and it works on its own, but when I run it with |
Beta Was this translation helpful? Give feedback.
-
Hi, I'd like to include a rule to add newlines around control structures like so:
becomes this:
Essentially, adding a newline both before and after a control structure (and ensuring it's only one line total in the case of back-to-back control structures).
First, I can't seem to find a rule that works for this. When I include
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
, it almost gets me there, because it seems to be adding newlines after the control structure, but not before:Even more confusing, because we want to lint against the PSR-12 standard, when we add
<rule ref="PSR12"/>
, it seems to overwrite the above rule andphpcbf
will not add any spacing around the control structures when I run it. When I dive into the PSR12 ruleset here, and pulled all the rules into my ownphpcs.xml
and started removing them one-by-one until the spacing worked to try to figure out potential conflicts, it seemed like<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
was the culprit, because when that is in the config along with<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
, the spacing is not added, but when I remove the former rule, the latter rule finally works.I tried excluding this from the PSR-12 config block in our file and I also tried
But none of this seems to work.
Any guidance on how to get this spacing rule working?
Beta Was this translation helpful? Give feedback.
All reactions