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/SpreadOperatorSpacingAfter: move parse error test to its own file #539

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,3 @@ $map = array_map(strtolower(...), $map);

// 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 @@ -69,6 +69,3 @@ $map = array_map(strtolower(...), $map);

// 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
@@ -0,0 +1,4 @@
<?php

// Intentional parse error. Testing that the sniff is *not* triggered in this case.
function bar( ...
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,29 @@ final class SpreadOperatorSpacingAfterUnitTest extends AbstractSniffUnitTest
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
public function getErrorList()
public function getErrorList($testFile='')
{
return [
12 => 1,
13 => 1,
20 => 2,
40 => 1,
41 => 1,
46 => 2,
60 => 1,
61 => 1,
66 => 2,
];
switch ($testFile) {
case 'SpreadOperatorSpacingAfterUnitTest.1.inc':
return [
12 => 1,
13 => 1,
20 => 2,
40 => 1,
41 => 1,
46 => 2,
60 => 1,
61 => 1,
66 => 2,
];

default:
return [];
}//end switch

}//end getErrorList()

Expand Down