Skip to content

Commit

Permalink
PHP 8.0 | Generic/ArrayIndent: add tests with named function call par…
Browse files Browse the repository at this point in the history
…ameters

... to confirm that the sniff does not break on these.
  • Loading branch information
jrfnl committed Mar 5, 2021
1 parent 377a467 commit 77cd2c8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 18 deletions.
13 changes: 13 additions & 0 deletions src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ $array = [
match ($test) { 1 => 'a', 2 => 'b' }
=> 'dynamic keys, woho!',
];

// Ensure that PHP 8.0 named parameters don't affect the sniff.
$array = [
functionCall(
name: $value
),
];

$array = [
functionCall(
name: $value
),
];
13 changes: 13 additions & 0 deletions src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,16 @@ $array = [
match ($test) { 1 => 'a', 2 => 'b' }
=> 'dynamic keys, woho!',
];

// Ensure that PHP 8.0 named parameters don't affect the sniff.
$array = [
functionCall(
name: $value
),
];

$array = [
functionCall(
name: $value
),
];
37 changes: 19 additions & 18 deletions src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ class ArrayIndentUnitTest extends AbstractSniffUnitTest
public function getErrorList()
{
return [
14 => 1,
15 => 1,
17 => 1,
30 => 1,
31 => 1,
33 => 1,
41 => 1,
62 => 1,
63 => 1,
69 => 1,
77 => 1,
78 => 1,
79 => 1,
85 => 1,
86 => 1,
87 => 1,
88 => 1,
98 => 1,
14 => 1,
15 => 1,
17 => 1,
30 => 1,
31 => 1,
33 => 1,
41 => 1,
62 => 1,
63 => 1,
69 => 1,
77 => 1,
78 => 1,
79 => 1,
85 => 1,
86 => 1,
87 => 1,
88 => 1,
98 => 1,
110 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 77cd2c8

Please sign in to comment.