@@ -62,7 +62,6 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
62
62
// Determine how far indented the entire array declaration should be.
63
63
$ ignore = Tokens::$ emptyTokens ;
64
64
$ ignore [] = T_DOUBLE_ARROW ;
65
- $ ignore [] = T_COMMA ;
66
65
$ prev = $ phpcsFile ->findPrevious ($ ignore , ($ stackPtr - 1 ), null , true );
67
66
$ start = $ phpcsFile ->findStartOfStatement ($ prev );
68
67
$ first = $ phpcsFile ->findFirstOnLine (T_WHITESPACE , $ start , true );
@@ -152,28 +151,27 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
152
151
$ error = 'Closing brace of array declaration must be on a new line ' ;
153
152
$ fix = $ phpcsFile ->addFixableError ($ error , $ arrayEnd , 'CloseBraceNotNewLine ' );
154
153
if ($ fix === true ) {
155
- $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedIndent );
154
+ $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ startIndent );
156
155
$ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
157
156
}
158
157
159
158
return ;
160
159
}
161
160
162
161
// 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 ) {
166
164
return ;
167
165
}
168
166
169
167
$ pluralizeSpace = 's ' ;
170
- if ($ expectedIndent === 1 ) {
168
+ if ($ startIndent === 1 ) {
171
169
$ pluralizeSpace = '' ;
172
170
}
173
171
174
172
$ error = 'Array close brace not indented correctly; expected %s space%s but found %s ' ;
175
173
$ data = [
176
- $ expectedIndent ,
174
+ $ startIndent ,
177
175
$ pluralizeSpace ,
178
176
$ foundIndent ,
179
177
];
@@ -182,7 +180,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
182
180
return ;
183
181
}
184
182
185
- $ padding = str_repeat (' ' , $ expectedIndent );
183
+ $ padding = str_repeat (' ' , $ startIndent );
186
184
if ($ foundIndent === 0 ) {
187
185
$ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
188
186
} else {
0 commit comments