Closed
Description
I think there is a problem with detection of the :
operator in ternary in combination with a function. I found this out while using Squiz.WhiteSpace.OperatorSpacing
, but it can be more general.
This case throws error:
<?php
$x = $foo
? function (): int {
return 1;
}
: $bar;
4 | ERROR | [x] Expected 1 space before ":"; 0 found (Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore)
while just inverting the condition is ok:
<?php
$x = !$foo
? $bar
: function (): int {
return 1;
};