@@ -99,7 +99,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
99
99
return ;
100
100
}//end if
101
101
102
- $ expectedIndent = ($ startIndent + $ this ->indent );
102
+ $ expectedElementIndent = ($ startIndent + $ this ->indent );
103
103
104
104
foreach ($ indices as $ index ) {
105
105
if (isset ($ index ['index_start ' ]) === true ) {
@@ -118,18 +118,18 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
118
118
$ first = $ phpcsFile ->findFirstOnLine (T_WHITESPACE , $ start , true );
119
119
120
120
$ foundIndent = ($ tokens [$ first ]['column ' ] - 1 );
121
- if ($ foundIndent === $ expectedIndent ) {
121
+ if ($ foundIndent === $ expectedElementIndent ) {
122
122
continue ;
123
123
}
124
124
125
125
$ pluralizeSpace = 's ' ;
126
- if ($ expectedIndent === 1 ) {
126
+ if ($ expectedElementIndent === 1 ) {
127
127
$ pluralizeSpace = '' ;
128
128
}
129
129
130
130
$ error = 'Array key not indented correctly; expected %s space%s but found %s ' ;
131
131
$ data = [
132
- $ expectedIndent ,
132
+ $ expectedElementIndent ,
133
133
$ pluralizeSpace ,
134
134
$ foundIndent ,
135
135
];
@@ -138,7 +138,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
138
138
continue ;
139
139
}
140
140
141
- $ padding = str_repeat (' ' , $ expectedIndent );
141
+ $ padding = str_repeat (' ' , $ expectedElementIndent );
142
142
if ($ foundIndent === 0 ) {
143
143
$ phpcsFile ->fixer ->addContentBefore ($ first , $ padding );
144
144
} else {
@@ -151,28 +151,28 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
151
151
$ error = 'Closing brace of array declaration must be on a new line ' ;
152
152
$ fix = $ phpcsFile ->addFixableError ($ error , $ arrayEnd , 'CloseBraceNotNewLine ' );
153
153
if ($ fix === true ) {
154
- $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedIndent );
154
+ $ padding = $ phpcsFile ->eolChar .str_repeat (' ' , $ expectedElementIndent );
155
155
$ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
156
156
}
157
157
158
158
return ;
159
159
}
160
160
161
161
// 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 ) {
165
165
return ;
166
166
}
167
167
168
168
$ pluralizeSpace = 's ' ;
169
- if ($ expectedIndent === 1 ) {
169
+ if ($ expectedCloseBraceIndent === 1 ) {
170
170
$ pluralizeSpace = '' ;
171
171
}
172
172
173
173
$ error = 'Array close brace not indented correctly; expected %s space%s but found %s ' ;
174
174
$ data = [
175
- $ expectedIndent ,
175
+ $ expectedCloseBraceIndent ,
176
176
$ pluralizeSpace ,
177
177
$ foundIndent ,
178
178
];
@@ -181,7 +181,7 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
181
181
return ;
182
182
}
183
183
184
- $ padding = str_repeat (' ' , $ expectedIndent );
184
+ $ padding = str_repeat (' ' , $ expectedCloseBraceIndent );
185
185
if ($ foundIndent === 0 ) {
186
186
$ phpcsFile ->fixer ->addContentBefore ($ arrayEnd , $ padding );
187
187
} else {
0 commit comments