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

Generic.WhiteSpace.SpreadOperatorSpacingAfter does not ignore spread operator in PHP 8.1 first class callables #3694

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function process(File $phpcsFile, $stackPtr)
return;
}

if ($tokens[$nextNonEmpty]['code'] === T_CLOSE_PARENTHESIS) {
// Ignore PHP 8.1 first class callable syntax.
return;
}

if ($this->ignoreNewlines === true
&& $tokens[$stackPtr]['line'] !== $tokens[$nextNonEmpty]['line']
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ function bar( & ... $spread ) {
);
}

// Ignore PHP 8.1 first class callable declarations.
$map = array_map(strtolower(...), $map);

// phpcs:set Generic.WhiteSpace.SpreadOperatorSpacingAfter spacing 0

// Ignore PHP 8.1 first class callable declarations.
$map = array_map(strtolower( ... ), $map);

// Intentional parse error. This has to be the last test in the file.
function bar( ...
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ function bar( & ... $spread ) {
);
}

// Ignore PHP 8.1 first class callable declarations.
$map = array_map(strtolower(...), $map);

// phpcs:set Generic.WhiteSpace.SpreadOperatorSpacingAfter spacing 0

// Ignore PHP 8.1 first class callable declarations.
$map = array_map(strtolower( ... ), $map);

// Intentional parse error. This has to be the last test in the file.
function bar( ...