coding-standard
coding-standard copied to clipboard
Closure variables from use are handled same way as its parameters
When using closure with multiple parameters each on new line, sniffer requires every variable in use to be each on new line too.
Example:
$foo = 1;
$bar = 2;
static function (
bool $param1,
bool $param2
) use ($foo, $bar): int {
return $foo + $bar;
}
…leads to…
ERROR | [x] Multi-line use declarations must define one parameter per line
| (Squiz.Functions.MultiLineFunctionDeclaration.UseOneParamPerLine)
Expected behaviour:
This should be fine since each parameter is defined on separate line. To put variables in use each on new line indeed let sniffer to pass; but it leads to worse code readability.