@@ -99,7 +99,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
9999 return ;
100100 }//end if
101101
102- $ expectedIndent = ($ startIndent + $ this ->indent );
102+ $ expectedElementIndent = ($ startIndent + $ this ->indent );
103103
104104 foreach ($ indices as $ index ) {
105105 if (isset ($ index ['index_start ' ]) === true ) {
@@ -118,18 +118,18 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
118118 $ first = $ phpcsFile ->findFirstOnLine (T_WHITESPACE , $ start , true );
119119
120120 $ foundIndent = ($ tokens [$ first ]['column ' ] - 1 );
121- if ($ foundIndent === $ expectedIndent ) {
121+ if ($ foundIndent === $ expectedElementIndent ) {
122122 continue ;
123123 }
124124
125125 $ pluralizeSpace = 's ' ;
126- if ($ expectedIndent === 1 ) {
126+ if ($ expectedElementIndent === 1 ) {
127127 $ pluralizeSpace = '' ;
128128 }
129129
130130 $ error = 'Array key not indented correctly; expected %s space%s but found %s ' ;
131131 $ data = [
132- $ expectedIndent ,
132+ $ expectedElementIndent ,
133133 $ pluralizeSpace ,
134134 $ foundIndent ,
135135 ];
@@ -138,7 +138,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
138138 continue ;
139139 }
140140
141- $ padding = str_repeat (' ' , $ expectedIndent );
141+ $ padding = str_repeat (' ' , $ expectedElementIndent );
142142 if ($ foundIndent === 0 ) {
143143 $ phpcsFile ->fixer ->addContentBefore ($ first , $ padding );
144144 } else {
@@ -151,28 +151,28 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
151151 $ error = 'Closing brace of array declaration must be on a new line ' ;
152152 $ fix = $ phpcsFile ->addFixableError ($ error , $ arrayEnd , 'CloseBraceNotNewLine ' );
153153 if ($ fix === true ) {
154- $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedIndent );
154+ $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedElementIndent );
155155 $ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
156156 }
157157
158158 return ;
159159 }
160160
161161 // The close brace must be indented one stop less.
162- $ expectedIndent -= $ this ->indent ;
163- $ foundIndent = ($ tokens [$ arrayEnd ]['column ' ] - 1 );
164- if ($ foundIndent === $ expectedIndent ) {
162+ $ expectedCloseBraceIndent = ( $ expectedElementIndent - $ this ->indent ) ;
163+ $ foundIndent = ($ tokens [$ arrayEnd ]['column ' ] - 1 );
164+ if ($ foundIndent === $ expectedCloseBraceIndent ) {
165165 return ;
166166 }
167167
168168 $ pluralizeSpace = 's ' ;
169- if ($ expectedIndent === 1 ) {
169+ if ($ expectedCloseBraceIndent === 1 ) {
170170 $ pluralizeSpace = '' ;
171171 }
172172
173173 $ error = 'Array close brace not indented correctly; expected %s space%s but found %s ' ;
174174 $ data = [
175- $ expectedIndent ,
175+ $ expectedCloseBraceIndent ,
176176 $ pluralizeSpace ,
177177 $ foundIndent ,
178178 ];
@@ -181,7 +181,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
181181 return ;
182182 }
183183
184- $ padding = str_repeat (' ' , $ expectedIndent );
184+ $ padding = str_repeat (' ' , $ expectedCloseBraceIndent );
185185 if ($ foundIndent === 0 ) {
186186 $ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
187187 } else {
0 commit comments