Skip to content

Commit

Permalink
Merge pull request #539 from biinari/chore/143-Generic_SpreadOperator…
Browse files Browse the repository at this point in the history
…SpacingAfter_separate_parse_error

Generic/SpreadOperatorSpacingAfter: move parse error test to its own file
  • Loading branch information
jrfnl authored Jul 13, 2024
2 parents 27678e7 + 530e7ab commit 0b67d68
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
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

0 comments on commit 0b67d68

Please sign in to comment.