Skip to content

Commit f74f671

Browse files
Merge pull request #66 from VincentLanglet/fixArray
🐛 Fix indent for array
2 parents 799de09 + 8720f8a commit f74f671

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

SymfonyCustom/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function processMultiLineArray(File $phpcsFile, $stackPtr, $arrayStart, $
281281
$tokens = $phpcsFile->getTokens();
282282

283283
$indent = $phpcsFile->findFirstOnLine(T_WHITESPACE, $arrayStart);
284-
if (false === $indent) {
284+
if (false === $indent || $tokens[$indent]['column'] > 1) {
285285
$currentIndent = 0;
286286
} else {
287287
$currentIndent = mb_strlen($tokens[$indent]['content']);

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,8 @@ class TestClass
130130
);
131131
}
132132
}
133+
134+
return [
135+
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
136+
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
137+
];

SymfonyCustom/Tests/Arrays/ArrayDeclarationUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,8 @@ class TestClass
130130
);
131131
}
132132
}
133+
134+
return [
135+
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
136+
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
137+
];

0 commit comments

Comments
 (0)