diff --git a/src/Sniffs/AbstractArraySniff.php b/src/Sniffs/AbstractArraySniff.php index 072a9d0cb1..2135c1ccc9 100644 --- a/src/Sniffs/AbstractArraySniff.php +++ b/src/Sniffs/AbstractArraySniff.php @@ -99,6 +99,7 @@ public function process(File $phpcsFile, $stackPtr) if ($tokens[$checkToken]['code'] === T_ARRAY || $tokens[$checkToken]['code'] === T_OPEN_SHORT_ARRAY || $tokens[$checkToken]['code'] === T_CLOSURE + || $tokens[$checkToken]['code'] === T_FN ) { // Let subsequent calls of this test handle nested arrays. if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) { diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc index d29e57f759..c11d979cf9 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc @@ -57,6 +57,8 @@ $array = [ 'hey' => $baz ?? ['one'] ?? ['two'], + 'fn' => + fn ($x) => yield 'k' => $x, ]; // phpcs:set Generic.Arrays.ArrayIndent indent 2 diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed index 40a3705e66..94ea2f44d8 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc.fixed @@ -58,6 +58,8 @@ $array = [ 'hey' => $baz ?? ['one'] ?? ['two'], + 'fn' => + fn ($x) => yield 'k' => $x, ]; // phpcs:set Generic.Arrays.ArrayIndent indent 2 diff --git a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php index 730d044906..9f9670f164 100644 --- a/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php +++ b/src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php @@ -33,10 +33,10 @@ public function getErrorList() 31 => 1, 33 => 1, 41 => 1, - 65 => 1, - 66 => 1, 67 => 1, 68 => 1, + 69 => 1, + 70 => 1, ]; }//end getErrorList()