Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure variables from use are handled same way as its parameters #61

Open
jaCUBE opened this issue Jan 9, 2020 · 0 comments
Open

Closure variables from use are handled same way as its parameters #61

jaCUBE opened this issue Jan 9, 2020 · 0 comments

Comments

@jaCUBE
Copy link

jaCUBE commented Jan 9, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant