diff --git a/SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php b/SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php
index 6d5d056..6493f6c 100644
--- a/SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php
+++ b/SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php
@@ -391,6 +391,16 @@ public function processMultiLineArray(File $phpcsFile, int $stackPtr, int $start
$indexEnd = $phpcsFile->findPrevious(T_WHITESPACE, $nextToken - 1, $start, true);
$indexStart = $phpcsFile->findStartOfStatement($indexEnd);
+ // Handle multi-lines index.
+ while ($tokens[$indexStart]['line'] !== $tokens[$indexEnd]['line']) {
+ $indexStart = $phpcsFile->findNext(
+ Tokens::$emptyTokens,
+ $indexStart + 1,
+ $indexEnd + 1,
+ true
+ );
+ }
+
if ($indexStart === $indexEnd) {
$currentEntry['index'] = $indexEnd;
$currentEntry['index_content'] = $tokens[$indexEnd]['content'];
diff --git a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc
index 1452f2e..488e95d 100644
--- a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc
+++ b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc
@@ -149,3 +149,15 @@ return [
];
[1 => 2 , 2=>3,4 => 5];
+
+$array = [
+ 'lonnnnnnggggg' => 'good',
+ 'short'
+ => 'bad',
+];
+
+$array = [
+ 'lonnnnnngggggg' => 'good',
+ $ab .
+ 'second' => 'bad',
+];
diff --git a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed
index df72752..90f8690 100644
--- a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed
+++ b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed
@@ -147,3 +147,14 @@ return [
];
[1 => 2, 2 => 3, 4 => 5];
+
+$array = [
+ 'lonnnnnnggggg' => 'good',
+ 'short' => 'bad',
+];
+
+$array = [
+ 'lonnnnnngggggg' => 'good',
+ $ab .
+ 'second' => 'bad',
+];
diff --git a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php
index 2d6bd27..08d2186 100644
--- a/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php
+++ b/SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.php
@@ -47,6 +47,8 @@ protected function getErrorList(): array
142 => 1,
148 => 1,
151 => 7,
+ 156 => 1,
+ 162 => 1,
];
}
diff --git a/build.xml b/build.xml
index 907222f..193ef13 100644
--- a/build.xml
+++ b/build.xml
@@ -29,13 +29,10 @@
-
-
-
+
-
-
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 833bd1d..7157b1e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -10,9 +10,12 @@
stopOnFailure="false"
bootstrap="./bootstrap.php"
>
-
-
- ./vendor/squizlabs/php_codesniffer/src/Standards/SymfonyCustom
-
-
+
+
+ ./vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php
+
+
+ ./TwigCS
+
+