Skip to content

Commit 94c9448

Browse files
committed
PHP 8.0 | Squiz/OperatorBracket: add tests with named function call parameters
... to confirm that the sniff does not break on these.
1 parent 377a467 commit 94c9448

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,8 @@ $expr = match ($number % 10) {
188188
$expr = match (true) {
189189
$num * 100 > 500 => 'expression in key',
190190
};
191+
192+
// PHP 8.0 named parameters.
193+
if ($pos === count(value: $this->tokens) - 1) {
194+
$file = '...'.substr(string: $file, offset: $padding * -1 + 3);
195+
}

src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,8 @@ $expr = match ($number % 10) {
188188
$expr = match (true) {
189189
($num * 100) > 500 => 'expression in key',
190190
};
191+
192+
// PHP 8.0 named parameters.
193+
if ($pos === (count(value: $this->tokens) - 1)) {
194+
$file = '...'.substr(string: $file, offset: ($padding * -1 + 3));
195+
}

src/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public function getErrorList($testFile='OperatorBracketUnitTest.inc')
7070
176 => 1,
7171
185 => 1,
7272
189 => 1,
73+
193 => 1,
74+
194 => 3,
7375
];
7476
break;
7577
case 'OperatorBracketUnitTest.js':

0 commit comments

Comments
 (0)