In PSR12, the BooleanOperatorPlacementSniff allow both
if (
$a &&
$b
)
and
if (
$a
&& $b
)
It could be great having an option like $allowFirstOnly to restrict only this
if (
$a
&& $b
)
And the same way $allowLastOnly to restrict only this
if (
$a &&
$b
)
@gsherwood If you're interested, I can make the PR
Could this also be a single option allowOnly with string values first and last? Defaults to nothing/null as to allow both.
I think having two boolean ones sound a bit weird.
@VincentLanglet Yes, I'm very interested. A single sniff property would be best.
@gsherwood I started something https://github.com/squizlabs/PHP_CodeSniffer/pull/2680
I started something #2680
Thanks. I'm not sure if you can do this after creating the PR, but using the draft PR feature might be good for this one.
Most helpful comment
Could this also be a single option
allowOnlywith string valuesfirstandlast? Defaults to nothing/null as to allow both.I think having two boolean ones sound a bit weird.