@@ -62,7 +62,6 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
6262 // Determine how far indented the entire array declaration should be.
6363 $ ignore = Tokens::$ emptyTokens ;
6464 $ ignore [] = T_DOUBLE_ARROW ;
65- $ ignore [] = T_COMMA ;
6665 $ prev = $ phpcsFile ->findPrevious ($ ignore , ($ stackPtr - 1 ), null , true );
6766 $ start = $ phpcsFile ->findStartOfStatement ($ prev );
6867 $ first = $ phpcsFile ->findFirstOnLine (T_WHITESPACE , $ start , true );
@@ -152,28 +151,27 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
152151 $ error = 'Closing brace of array declaration must be on a new line ' ;
153152 $ fix = $ phpcsFile ->addFixableError ($ error , $ arrayEnd , 'CloseBraceNotNewLine ' );
154153 if ($ fix === true ) {
155- $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedIndent );
154+ $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ startIndent );
156155 $ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
157156 }
158157
159158 return ;
160159 }
161160
162161 // The close brace must be indented one stop less.
163- $ expectedIndent -= $ this ->indent ;
164- $ foundIndent = ($ tokens [$ arrayEnd ]['column ' ] - 1 );
165- if ($ foundIndent === $ expectedIndent ) {
162+ $ foundIndent = ($ tokens [$ arrayEnd ]['column ' ] - 1 );
163+ if ($ foundIndent === $ startIndent ) {
166164 return ;
167165 }
168166
169167 $ pluralizeSpace = 's ' ;
170- if ($ expectedIndent === 1 ) {
168+ if ($ startIndent === 1 ) {
171169 $ pluralizeSpace = '' ;
172170 }
173171
174172 $ error = 'Array close brace not indented correctly; expected %s space%s but found %s ' ;
175173 $ data = [
176- $ expectedIndent ,
174+ $ startIndent ,
177175 $ pluralizeSpace ,
178176 $ foundIndent ,
179177 ];
@@ -182,7 +180,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
182180 return ;
183181 }
184182
185- $ padding = str_repeat (' ' , $ expectedIndent );
183+ $ padding = str_repeat (' ' , $ startIndent );
186184 if ($ foundIndent === 0 ) {
187185 $ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
188186 } else {
0 commit comments