@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Returns an array of tokens this test wants to listen for. |
31 | 31 | * |
32 | - * @return array |
|
32 | + * @return integer[] |
|
33 | 33 | */ |
34 | 34 | public function register() { |
35 | 35 | return array( |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function process_token( $stackPtr ) { |
49 | 49 | |
50 | 50 | if ( ! $this->has_whitelist_comment( 'loose comparison', $stackPtr ) ) { |
51 | - $error = 'Found: ' . $this->tokens[ $stackPtr ]['content'] . '. Use strict comparisons (=== or !==).'; |
|
51 | + $error = 'Found: ' . $this->tokens[ $stackPtr ][ 'content' ] . '. Use strict comparisons (=== or !==).'; |
|
52 | 52 | $this->phpcsFile->addWarning( $error, $stackPtr, 'LooseComparison' ); |
53 | 53 | } |
54 | 54 | } |
@@ -165,7 +165,7 @@ |
||
165 | 165 | /** |
166 | 166 | * Returns an array of tokens this test wants to listen for. |
167 | 167 | * |
168 | - * @return array |
|
168 | + * @return integer[] |
|
169 | 169 | */ |
170 | 170 | public function register() { |
171 | 171 |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | |
191 | 191 | $this->mergeFunctionLists(); |
192 | 192 | |
193 | - $function = $this->tokens[ $stackPtr ]['content']; |
|
193 | + $function = $this->tokens[ $stackPtr ][ 'content' ]; |
|
194 | 194 | |
195 | 195 | // Find the opening parenthesis (if present; T_ECHO might not have it). |
196 | 196 | $open_paren = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true ); |
197 | 197 | |
198 | 198 | // If function, not T_ECHO nor T_PRINT. |
199 | - if ( \T_STRING === $this->tokens[ $stackPtr ]['code'] ) { |
|
199 | + if ( \T_STRING === $this->tokens[ $stackPtr ][ 'code' ] ) { |
|
200 | 200 | // Skip if it is a function but is not one of the printing functions. |
201 | - if ( ! isset( $this->printingFunctions[ $this->tokens[ $stackPtr ]['content'] ] ) ) { |
|
201 | + if ( ! isset( $this->printingFunctions[ $this->tokens[ $stackPtr ][ 'content' ] ] ) ) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | - if ( isset( $this->tokens[ $open_paren ]['parenthesis_closer'] ) ) { |
|
206 | - $end_of_statement = $this->tokens[ $open_paren ]['parenthesis_closer']; |
|
205 | + if ( isset( $this->tokens[ $open_paren ][ 'parenthesis_closer' ] ) ) { |
|
206 | + $end_of_statement = $this->tokens[ $open_paren ][ 'parenthesis_closer' ]; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // These functions only need to have the first argument escaped. |
210 | 210 | if ( \in_array( $function, array( 'trigger_error', 'user_error' ), true ) ) { |
211 | 211 | $first_param = $this->get_function_call_parameter( $stackPtr, 1 ); |
212 | - $end_of_statement = ( $first_param['end'] + 1 ); |
|
212 | + $end_of_statement = ( $first_param[ 'end' ] + 1 ); |
|
213 | 213 | unset( $first_param ); |
214 | 214 | } |
215 | 215 | } |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | |
244 | 244 | // Check for the ternary operator. We only need to do this here if this |
245 | 245 | // echo is lacking parenthesis. Otherwise it will be handled below. |
246 | - if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $open_paren ]['code'] || \T_CLOSE_PARENTHESIS !== $this->tokens[ $last_token ]['code'] ) { |
|
246 | + if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $open_paren ][ 'code' ] || \T_CLOSE_PARENTHESIS !== $this->tokens[ $last_token ][ 'code' ] ) { |
|
247 | 247 | |
248 | 248 | $ternary = $this->phpcsFile->findNext( \T_INLINE_THEN, $stackPtr, $end_of_statement ); |
249 | 249 | |
250 | 250 | // If there is a ternary skip over the part before the ?. However, if |
251 | 251 | // the ternary is within parentheses, it will be handled in the loop. |
252 | - if ( false !== $ternary && empty( $this->tokens[ $ternary ]['nested_parenthesis'] ) ) { |
|
252 | + if ( false !== $ternary && empty( $this->tokens[ $ternary ][ 'nested_parenthesis' ] ) ) { |
|
253 | 253 | $stackPtr = $ternary; |
254 | 254 | } |
255 | 255 | } |
@@ -265,18 +265,18 @@ discard block |
||
265 | 265 | for ( $i = $stackPtr; $i < $end_of_statement; $i++ ) { |
266 | 266 | |
267 | 267 | // Ignore whitespaces and comments. |
268 | - if ( isset( Tokens::$emptyTokens[ $this->tokens[ $i ]['code'] ] ) ) { |
|
268 | + if ( isset( Tokens::$emptyTokens[ $this->tokens[ $i ][ 'code' ] ] ) ) { |
|
269 | 269 | continue; |
270 | 270 | } |
271 | 271 | |
272 | 272 | // Ignore namespace separators. |
273 | - if ( \T_NS_SEPARATOR === $this->tokens[ $i ]['code'] ) { |
|
273 | + if ( \T_NS_SEPARATOR === $this->tokens[ $i ][ 'code' ] ) { |
|
274 | 274 | continue; |
275 | 275 | } |
276 | 276 | |
277 | - if ( \T_OPEN_PARENTHESIS === $this->tokens[ $i ]['code'] ) { |
|
277 | + if ( \T_OPEN_PARENTHESIS === $this->tokens[ $i ][ 'code' ] ) { |
|
278 | 278 | |
279 | - if ( ! isset( $this->tokens[ $i ]['parenthesis_closer'] ) ) { |
|
279 | + if ( ! isset( $this->tokens[ $i ][ 'parenthesis_closer' ] ) ) { |
|
280 | 280 | // Live coding or parse error. |
281 | 281 | break; |
282 | 282 | } |
@@ -284,20 +284,20 @@ discard block |
||
284 | 284 | if ( $in_cast ) { |
285 | 285 | |
286 | 286 | // Skip to the end of a function call if it has been casted to a safe value. |
287 | - $i = $this->tokens[ $i ]['parenthesis_closer']; |
|
287 | + $i = $this->tokens[ $i ][ 'parenthesis_closer' ]; |
|
288 | 288 | $in_cast = false; |
289 | 289 | |
290 | 290 | } else { |
291 | 291 | |
292 | 292 | // Skip over the condition part of a ternary (i.e., to after the ?). |
293 | - $ternary = $this->phpcsFile->findNext( \T_INLINE_THEN, $i, $this->tokens[ $i ]['parenthesis_closer'] ); |
|
293 | + $ternary = $this->phpcsFile->findNext( \T_INLINE_THEN, $i, $this->tokens[ $i ][ 'parenthesis_closer' ] ); |
|
294 | 294 | |
295 | 295 | if ( false !== $ternary ) { |
296 | 296 | |
297 | - $next_paren = $this->phpcsFile->findNext( \T_OPEN_PARENTHESIS, ( $i + 1 ), $this->tokens[ $i ]['parenthesis_closer'] ); |
|
297 | + $next_paren = $this->phpcsFile->findNext( \T_OPEN_PARENTHESIS, ( $i + 1 ), $this->tokens[ $i ][ 'parenthesis_closer' ] ); |
|
298 | 298 | |
299 | 299 | // We only do it if the ternary isn't within a subset of parentheses. |
300 | - if ( false === $next_paren || ( isset( $this->tokens[ $next_paren ]['parenthesis_closer'] ) && $ternary > $this->tokens[ $next_paren ]['parenthesis_closer'] ) ) { |
|
300 | + if ( false === $next_paren || ( isset( $this->tokens[ $next_paren ][ 'parenthesis_closer' ] ) && $ternary > $this->tokens[ $next_paren ][ 'parenthesis_closer' ] ) ) { |
|
301 | 301 | $i = $ternary; |
302 | 302 | } |
303 | 303 | } |
@@ -307,48 +307,48 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | // Handle arrays for those functions that accept them. |
310 | - if ( \T_ARRAY === $this->tokens[ $i ]['code'] ) { |
|
310 | + if ( \T_ARRAY === $this->tokens[ $i ][ 'code' ] ) { |
|
311 | 311 | $i++; // Skip the opening parenthesis. |
312 | 312 | continue; |
313 | 313 | } |
314 | 314 | |
315 | - if ( \T_OPEN_SHORT_ARRAY === $this->tokens[ $i ]['code'] |
|
316 | - || \T_CLOSE_SHORT_ARRAY === $this->tokens[ $i ]['code'] |
|
315 | + if ( \T_OPEN_SHORT_ARRAY === $this->tokens[ $i ][ 'code' ] |
|
316 | + || \T_CLOSE_SHORT_ARRAY === $this->tokens[ $i ][ 'code' ] |
|
317 | 317 | ) { |
318 | 318 | continue; |
319 | 319 | } |
320 | 320 | |
321 | - if ( \in_array( $this->tokens[ $i ]['code'], array( \T_DOUBLE_ARROW, \T_CLOSE_PARENTHESIS ), true ) ) { |
|
321 | + if ( \in_array( $this->tokens[ $i ][ 'code' ], array( \T_DOUBLE_ARROW, \T_CLOSE_PARENTHESIS ), true ) ) { |
|
322 | 322 | continue; |
323 | 323 | } |
324 | 324 | |
325 | 325 | // Handle magic constants for debug functions. |
326 | - if ( isset( $this->magic_constant_tokens[ $this->tokens[ $i ]['type'] ] ) ) { |
|
326 | + if ( isset( $this->magic_constant_tokens[ $this->tokens[ $i ][ 'type' ] ] ) ) { |
|
327 | 327 | continue; |
328 | 328 | } |
329 | 329 | |
330 | 330 | // Handle safe PHP native constants. |
331 | - if ( \T_STRING === $this->tokens[ $i ]['code'] |
|
332 | - && isset( $this->safe_php_constants[ $this->tokens[ $i ]['content'] ] ) |
|
331 | + if ( \T_STRING === $this->tokens[ $i ][ 'code' ] |
|
332 | + && isset( $this->safe_php_constants[ $this->tokens[ $i ][ 'content' ] ] ) |
|
333 | 333 | && $this->is_use_of_global_constant( $i ) |
334 | 334 | ) { |
335 | 335 | continue; |
336 | 336 | } |
337 | 337 | |
338 | 338 | // Wake up on concatenation characters, another part to check. |
339 | - if ( \T_STRING_CONCAT === $this->tokens[ $i ]['code'] ) { |
|
339 | + if ( \T_STRING_CONCAT === $this->tokens[ $i ][ 'code' ] ) { |
|
340 | 340 | $watch = true; |
341 | 341 | continue; |
342 | 342 | } |
343 | 343 | |
344 | 344 | // Wake up after a ternary else (:). |
345 | - if ( false !== $ternary && \T_INLINE_ELSE === $this->tokens[ $i ]['code'] ) { |
|
345 | + if ( false !== $ternary && \T_INLINE_ELSE === $this->tokens[ $i ][ 'code' ] ) { |
|
346 | 346 | $watch = true; |
347 | 347 | continue; |
348 | 348 | } |
349 | 349 | |
350 | 350 | // Wake up for commas. |
351 | - if ( \T_COMMA === $this->tokens[ $i ]['code'] ) { |
|
351 | + if ( \T_COMMA === $this->tokens[ $i ][ 'code' ] ) { |
|
352 | 352 | $in_cast = false; |
353 | 353 | $watch = true; |
354 | 354 | continue; |
@@ -360,23 +360,23 @@ discard block |
||
360 | 360 | |
361 | 361 | // Allow T_CONSTANT_ENCAPSED_STRING eg: echo 'Some String'; |
362 | 362 | // Also T_LNUMBER, e.g.: echo 45; exit -1; and booleans. |
363 | - if ( isset( $this->safe_components[ $this->tokens[ $i ]['type'] ] ) ) { |
|
363 | + if ( isset( $this->safe_components[ $this->tokens[ $i ][ 'type' ] ] ) ) { |
|
364 | 364 | continue; |
365 | 365 | } |
366 | 366 | |
367 | 367 | $watch = false; |
368 | 368 | |
369 | 369 | // Allow int/double/bool casted variables. |
370 | - if ( isset( $this->safe_cast_tokens[ $this->tokens[ $i ]['type'] ] ) ) { |
|
370 | + if ( isset( $this->safe_cast_tokens[ $this->tokens[ $i ][ 'type' ] ] ) ) { |
|
371 | 371 | $in_cast = true; |
372 | 372 | continue; |
373 | 373 | } |
374 | 374 | |
375 | 375 | // Now check that next token is a function call. |
376 | - if ( \T_STRING === $this->tokens[ $i ]['code'] ) { |
|
376 | + if ( \T_STRING === $this->tokens[ $i ][ 'code' ] ) { |
|
377 | 377 | |
378 | 378 | $ptr = $i; |
379 | - $functionName = $this->tokens[ $i ]['content']; |
|
379 | + $functionName = $this->tokens[ $i ][ 'content' ]; |
|
380 | 380 | $function_opener = $this->phpcsFile->findNext( \T_OPEN_PARENTHESIS, ( $i + 1 ), null, false, null, true ); |
381 | 381 | $is_formatting_function = isset( $this->formattingFunctions[ $functionName ] ); |
382 | 382 | |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | */ |
398 | 398 | $mapped_function = $this->phpcsFile->findNext( |
399 | 399 | Tokens::$emptyTokens, |
400 | - $callback['start'], |
|
401 | - ( $callback['end'] + 1 ), |
|
400 | + $callback[ 'start' ], |
|
401 | + ( $callback[ 'end' ] + 1 ), |
|
402 | 402 | true |
403 | 403 | ); |
404 | 404 | |
405 | 405 | if ( false !== $mapped_function |
406 | - && \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $mapped_function ]['code'] |
|
406 | + && \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $mapped_function ][ 'code' ] |
|
407 | 407 | ) { |
408 | - $functionName = $this->strip_quotes( $this->tokens[ $mapped_function ]['content'] ); |
|
408 | + $functionName = $this->strip_quotes( $this->tokens[ $mapped_function ][ 'content' ] ); |
|
409 | 409 | $ptr = $mapped_function; |
410 | 410 | } |
411 | 411 | } |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | $i = ( $function_opener + 1 ); |
419 | 419 | $watch = true; |
420 | 420 | } else { |
421 | - if ( isset( $this->tokens[ $function_opener ]['parenthesis_closer'] ) ) { |
|
422 | - $i = $this->tokens[ $function_opener ]['parenthesis_closer']; |
|
421 | + if ( isset( $this->tokens[ $function_opener ][ 'parenthesis_closer' ] ) ) { |
|
422 | + $i = $this->tokens[ $function_opener ][ 'parenthesis_closer' ]; |
|
423 | 423 | } else { |
424 | 424 | // Live coding or parse error. |
425 | 425 | break; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $content = $functionName; |
440 | 440 | |
441 | 441 | } else { |
442 | - $content = $this->tokens[ $i ]['content']; |
|
442 | + $content = $this->tokens[ $i ][ 'content' ]; |
|
443 | 443 | $ptr = $i; |
444 | 444 | } |
445 | 445 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * @return void |
463 | 463 | */ |
464 | 464 | protected function mergeFunctionLists() { |
465 | - if ( $this->customEscapingFunctions !== $this->addedCustomFunctions['escape'] ) { |
|
465 | + if ( $this->customEscapingFunctions !== $this->addedCustomFunctions[ 'escape' ] ) { |
|
466 | 466 | $customEscapeFunctions = $this->merge_custom_array( $this->customEscapingFunctions, array(), false ); |
467 | 467 | |
468 | 468 | $this->escapingFunctions = $this->merge_custom_array( |
@@ -470,26 +470,26 @@ discard block |
||
470 | 470 | $this->escapingFunctions |
471 | 471 | ); |
472 | 472 | |
473 | - $this->addedCustomFunctions['escape'] = $this->customEscapingFunctions; |
|
473 | + $this->addedCustomFunctions[ 'escape' ] = $this->customEscapingFunctions; |
|
474 | 474 | } |
475 | 475 | |
476 | - if ( $this->customAutoEscapedFunctions !== $this->addedCustomFunctions['autoescape'] ) { |
|
476 | + if ( $this->customAutoEscapedFunctions !== $this->addedCustomFunctions[ 'autoescape' ] ) { |
|
477 | 477 | $this->autoEscapedFunctions = $this->merge_custom_array( |
478 | 478 | $this->customAutoEscapedFunctions, |
479 | 479 | $this->autoEscapedFunctions |
480 | 480 | ); |
481 | 481 | |
482 | - $this->addedCustomFunctions['autoescape'] = $this->customAutoEscapedFunctions; |
|
482 | + $this->addedCustomFunctions[ 'autoescape' ] = $this->customAutoEscapedFunctions; |
|
483 | 483 | } |
484 | 484 | |
485 | - if ( $this->customPrintingFunctions !== $this->addedCustomFunctions['print'] ) { |
|
485 | + if ( $this->customPrintingFunctions !== $this->addedCustomFunctions[ 'print' ] ) { |
|
486 | 486 | |
487 | 487 | $this->printingFunctions = $this->merge_custom_array( |
488 | 488 | $this->customPrintingFunctions, |
489 | 489 | $this->printingFunctions |
490 | 490 | ); |
491 | 491 | |
492 | - $this->addedCustomFunctions['print'] = $this->customPrintingFunctions; |
|
492 | + $this->addedCustomFunctions[ 'print' ] = $this->customPrintingFunctions; |
|
493 | 493 | } |
494 | 494 | } |
495 | 495 |
@@ -270,7 +270,7 @@ |
||
270 | 270 | /** |
271 | 271 | * Retrieve a list of misspellings based on an array of matched variations on the target word. |
272 | 272 | * |
273 | - * @param array $match_stack Array of matched variations of the target word. |
|
273 | + * @param string[] $match_stack Array of matched variations of the target word. |
|
274 | 274 | * @return array Array containing only the misspelled variants. |
275 | 275 | */ |
276 | 276 | protected function retrieve_misspellings( $match_stack ) { |
@@ -126,24 +126,24 @@ discard block |
||
126 | 126 | * The return values skip to the end of the array. |
127 | 127 | * This prevents the sniff "hanging" on very long configuration arrays. |
128 | 128 | */ |
129 | - if ( \T_OPEN_SHORT_ARRAY === $this->tokens[ $stackPtr ]['code'] && isset( $this->tokens[ $stackPtr ]['bracket_closer'] ) ) { |
|
130 | - return $this->tokens[ $stackPtr ]['bracket_closer']; |
|
131 | - } elseif ( \T_ARRAY === $this->tokens[ $stackPtr ]['code'] && isset( $this->tokens[ $stackPtr ]['parenthesis_closer'] ) ) { |
|
132 | - return $this->tokens[ $stackPtr ]['parenthesis_closer']; |
|
129 | + if ( \T_OPEN_SHORT_ARRAY === $this->tokens[ $stackPtr ][ 'code' ] && isset( $this->tokens[ $stackPtr ][ 'bracket_closer' ] ) ) { |
|
130 | + return $this->tokens[ $stackPtr ][ 'bracket_closer' ]; |
|
131 | + } elseif ( \T_ARRAY === $this->tokens[ $stackPtr ][ 'code' ] && isset( $this->tokens[ $stackPtr ][ 'parenthesis_closer' ] ) ) { |
|
132 | + return $this->tokens[ $stackPtr ][ 'parenthesis_closer' ]; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /* |
136 | 136 | * Deal with misspellings in class/interface/trait names. |
137 | 137 | * These are not auto-fixable, but need the attention of a developer. |
138 | 138 | */ |
139 | - if ( isset( Tokens::$ooScopeTokens[ $this->tokens[ $stackPtr ]['code'] ] ) ) { |
|
139 | + if ( isset( Tokens::$ooScopeTokens[ $this->tokens[ $stackPtr ][ 'code' ] ] ) ) { |
|
140 | 140 | $classname = $this->phpcsFile->getDeclarationName( $stackPtr ); |
141 | 141 | if ( empty( $classname ) ) { |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | 145 | if ( preg_match_all( self::WP_CLASSNAME_REGEX, $classname, $matches, \PREG_PATTERN_ORDER ) > 0 ) { |
146 | - $mispelled = $this->retrieve_misspellings( $matches[1] ); |
|
146 | + $mispelled = $this->retrieve_misspellings( $matches[ 1 ] ); |
|
147 | 147 | |
148 | 148 | if ( ! empty( $mispelled ) ) { |
149 | 149 | $this->phpcsFile->addWarning( |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | */ |
164 | 164 | |
165 | 165 | // Ignore content of docblock @link tags. |
166 | - if ( \T_DOC_COMMENT_STRING === $this->tokens[ $stackPtr ]['code'] |
|
167 | - || \T_DOC_COMMENT === $this->tokens[ $stackPtr ]['code'] |
|
166 | + if ( \T_DOC_COMMENT_STRING === $this->tokens[ $stackPtr ][ 'code' ] |
|
167 | + || \T_DOC_COMMENT === $this->tokens[ $stackPtr ][ 'code' ] |
|
168 | 168 | ) { |
169 | 169 | |
170 | 170 | $comment_start = $this->phpcsFile->findPrevious( \T_DOC_COMMENT_OPEN_TAG, ( $stackPtr - 1 ) ); |
171 | 171 | if ( false !== $comment_start ) { |
172 | 172 | $comment_tag = $this->phpcsFile->findPrevious( \T_DOC_COMMENT_TAG, ( $stackPtr - 1 ), $comment_start ); |
173 | - if ( false !== $comment_tag && '@link' === $this->tokens[ $comment_tag ]['content'] ) { |
|
173 | + if ( false !== $comment_tag && '@link' === $this->tokens[ $comment_tag ][ 'content' ] ) { |
|
174 | 174 | // @link tag, so ignore. |
175 | 175 | return; |
176 | 176 | } |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // Ignore any text strings which are array keys `$var['key']` as this is a false positive in 80% of all cases. |
181 | - if ( \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $stackPtr ]['code'] ) { |
|
181 | + if ( \T_CONSTANT_ENCAPSED_STRING === $this->tokens[ $stackPtr ][ 'code' ] ) { |
|
182 | 182 | $prevToken = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true, null, true ); |
183 | - if ( false !== $prevToken && \T_OPEN_SQUARE_BRACKET === $this->tokens[ $prevToken ]['code'] ) { |
|
183 | + if ( false !== $prevToken && \T_OPEN_SQUARE_BRACKET === $this->tokens[ $prevToken ][ 'code' ] ) { |
|
184 | 184 | $nextToken = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $stackPtr + 1 ), null, true, null, true ); |
185 | - if ( false !== $nextToken && \T_CLOSE_SQUARE_BRACKET === $this->tokens[ $nextToken ]['code'] ) { |
|
185 | + if ( false !== $nextToken && \T_CLOSE_SQUARE_BRACKET === $this->tokens[ $nextToken ][ 'code' ] ) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | } |
@@ -202,44 +202,44 @@ discard block |
||
202 | 202 | \T_OPEN_CURLY_BRACKET, |
203 | 203 | ); |
204 | 204 | $maybe_const = $this->phpcsFile->findPrevious( $stop_points, ( $stackPtr - 1 ) ); |
205 | - if ( false !== $maybe_const && \T_CONST === $this->tokens[ $maybe_const ]['code'] ) { |
|
205 | + if ( false !== $maybe_const && \T_CONST === $this->tokens[ $maybe_const ][ 'code' ] ) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
209 | - $content = $this->tokens[ $stackPtr ]['content']; |
|
209 | + $content = $this->tokens[ $stackPtr ][ 'content' ]; |
|
210 | 210 | |
211 | 211 | if ( preg_match_all( self::WP_REGEX, $content, $matches, ( \PREG_PATTERN_ORDER | \PREG_OFFSET_CAPTURE ) ) > 0 ) { |
212 | 212 | /* |
213 | 213 | * Prevent some typical false positives. |
214 | 214 | */ |
215 | - if ( isset( $this->text_and_comment_tokens[ $this->tokens[ $stackPtr ]['code'] ] ) ) { |
|
215 | + if ( isset( $this->text_and_comment_tokens[ $this->tokens[ $stackPtr ][ 'code' ] ] ) ) { |
|
216 | 216 | $offset = 0; |
217 | - foreach ( $matches[1] as $key => $match_data ) { |
|
218 | - $next_offset = ( $match_data[1] + \strlen( $match_data[0] ) ); |
|
217 | + foreach ( $matches[ 1 ] as $key => $match_data ) { |
|
218 | + $next_offset = ( $match_data[ 1 ] + \strlen( $match_data[ 0 ] ) ); |
|
219 | 219 | |
220 | 220 | // Prevent matches on part of a URL. |
221 | - if ( preg_match( '`http[s]?://[^\s<>\'"()]*' . preg_quote( $match_data[0], '`' ) . '`', $content, $discard, 0, $offset ) === 1 ) { |
|
222 | - unset( $matches[1][ $key ] ); |
|
223 | - } elseif ( preg_match( '`[a-z]+=(["\'])' . preg_quote( $match_data[0], '`' ) . '\1`', $content, $discard, 0, $offset ) === 1 ) { |
|
221 | + if ( preg_match( '`http[s]?://[^\s<>\'"()]*' . preg_quote( $match_data[ 0 ], '`' ) . '`', $content, $discard, 0, $offset ) === 1 ) { |
|
222 | + unset( $matches[ 1 ][ $key ] ); |
|
223 | + } elseif ( preg_match( '`[a-z]+=(["\'])' . preg_quote( $match_data[ 0 ], '`' ) . '\1`', $content, $discard, 0, $offset ) === 1 ) { |
|
224 | 224 | // Prevent matches on html attributes like: `value="wordpress"`. |
225 | - unset( $matches[1][ $key ] ); |
|
226 | - } elseif ( preg_match( '`\\\\\'' . preg_quote( $match_data[0], '`' ) . '\\\\\'`', $content, $discard, 0, $offset ) === 1 ) { |
|
225 | + unset( $matches[ 1 ][ $key ] ); |
|
226 | + } elseif ( preg_match( '`\\\\\'' . preg_quote( $match_data[ 0 ], '`' ) . '\\\\\'`', $content, $discard, 0, $offset ) === 1 ) { |
|
227 | 227 | // Prevent matches on xpath queries and such: `\'wordpress\'`. |
228 | - unset( $matches[1][ $key ] ); |
|
229 | - } elseif ( preg_match( '`(?:\?|&|&)[a-z0-9_]+=' . preg_quote( $match_data[0], '`' ) . '(?:&|$)`', $content, $discard, 0, $offset ) === 1 ) { |
|
228 | + unset( $matches[ 1 ][ $key ] ); |
|
229 | + } elseif ( preg_match( '`(?:\?|&|&)[a-z0-9_]+=' . preg_quote( $match_data[ 0 ], '`' ) . '(?:&|$)`', $content, $discard, 0, $offset ) === 1 ) { |
|
230 | 230 | // Prevent matches on url query strings: `?something=wordpress`. |
231 | - unset( $matches[1][ $key ] ); |
|
231 | + unset( $matches[ 1 ][ $key ] ); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $offset = $next_offset; |
235 | 235 | } |
236 | 236 | |
237 | - if ( empty( $matches[1] ) ) { |
|
237 | + if ( empty( $matches[ 1 ] ) ) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | - $mispelled = $this->retrieve_misspellings( $matches[1] ); |
|
242 | + $mispelled = $this->retrieve_misspellings( $matches[ 1 ] ); |
|
243 | 243 | |
244 | 244 | if ( empty( $mispelled ) ) { |
245 | 245 | return; |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | if ( true === $fix ) { |
259 | 259 | // Apply fixes based on offset to ensure we don't replace false positives. |
260 | 260 | $replacement = $content; |
261 | - foreach ( $matches[1] as $match ) { |
|
262 | - $replacement = substr_replace( $replacement, 'WordPress', $match[1], \strlen( $match[0] ) ); |
|
261 | + foreach ( $matches[ 1 ] as $match ) { |
|
262 | + $replacement = substr_replace( $replacement, 'WordPress', $match[ 1 ], \strlen( $match[ 0 ] ) ); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $this->phpcsFile->fixer->replaceToken( $stackPtr, $replacement ); |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | foreach ( $match_stack as $match ) { |
279 | 279 | // Deal with multi-dimensional arrays when capturing offset. |
280 | 280 | if ( \is_array( $match ) ) { |
281 | - $match = $match[0]; |
|
281 | + $match = $match[ 0 ]; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | if ( 'WordPress' !== $match ) { |
285 | - $mispelled[] = $match; |
|
285 | + $mispelled[ ] = $match; |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Returns an array of tokens this test wants to listen for. |
30 | 30 | * |
31 | - * @return array |
|
31 | + * @return string[] |
|
32 | 32 | */ |
33 | 33 | public function register() { |
34 | 34 | return array( |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | public function process_token( $stackPtr ) { |
47 | 47 | |
48 | 48 | $token = $this->tokens[ $stackPtr ]; |
49 | - if ( ! isset( $token['bracket_closer'] ) ) { |
|
49 | + if ( ! isset( $token[ 'bracket_closer' ] ) ) { |
|
50 | 50 | $this->phpcsFile->addWarning( 'Missing bracket closer.', $stackPtr, 'MissingBracketCloser' ); |
51 | 51 | return; |
52 | 52 | } |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | $need_spaces = $this->phpcsFile->findNext( |
55 | 55 | array( \T_CONSTANT_ENCAPSED_STRING, \T_LNUMBER, \T_WHITESPACE, \T_MINUS ), |
56 | 56 | ( $stackPtr + 1 ), |
57 | - $token['bracket_closer'], |
|
57 | + $token[ 'bracket_closer' ], |
|
58 | 58 | true |
59 | 59 | ); |
60 | 60 | |
61 | - $spaced1 = ( \T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ]['code'] ); |
|
62 | - $spaced2 = ( \T_WHITESPACE === $this->tokens[ ( $token['bracket_closer'] - 1 ) ]['code'] ); |
|
61 | + $spaced1 = ( \T_WHITESPACE === $this->tokens[ ( $stackPtr + 1 ) ][ 'code' ] ); |
|
62 | + $spaced2 = ( \T_WHITESPACE === $this->tokens[ ( $token[ 'bracket_closer' ] - 1 ) ][ 'code' ] ); |
|
63 | 63 | |
64 | 64 | // It should have spaces unless if it only has strings or numbers as the key. |
65 | 65 | if ( false !== $need_spaces && ! ( $spaced1 && $spaced2 ) ) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->phpcsFile->fixer->addContentBefore( ( $stackPtr + 1 ), ' ' ); |
71 | 71 | } |
72 | 72 | if ( ! $spaced2 ) { |
73 | - $this->phpcsFile->fixer->addContentBefore( $token['bracket_closer'], ' ' ); |
|
73 | + $this->phpcsFile->fixer->addContentBefore( $token[ 'bracket_closer' ], ' ' ); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } elseif ( false === $need_spaces && ( $spaced1 || $spaced2 ) ) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->phpcsFile->fixer->replaceToken( ( $stackPtr + 1 ), '' ); |
82 | 82 | } |
83 | 83 | if ( $spaced2 ) { |
84 | - $this->phpcsFile->fixer->replaceToken( ( $token['bracket_closer'] - 1 ), '' ); |
|
84 | + $this->phpcsFile->fixer->replaceToken( ( $token[ 'bracket_closer' ] - 1 ), '' ); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | /** |
52 | 52 | * Returns an array of tokens this test wants to listen for. |
53 | 53 | * |
54 | - * @return array |
|
54 | + * @return integer[] |
|
55 | 55 | */ |
56 | 56 | public function register() { |
57 | 57 | /* |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function process_token( $stackPtr ) { |
93 | 93 | // Make sure we have the right token, JS vs PHP. |
94 | - if ( ( 'PHP' === $this->phpcsFile->tokenizerType && \T_NEW !== $this->tokens[ $stackPtr ]['code'] ) |
|
94 | + if ( ( 'PHP' === $this->phpcsFile->tokenizerType && \T_NEW !== $this->tokens[ $stackPtr ][ 'code' ] ) |
|
95 | 95 | || ( 'JS' === $this->phpcsFile->tokenizerType |
96 | - && ( \T_STRING !== $this->tokens[ $stackPtr ]['code'] |
|
97 | - || 'new' !== strtolower( $this->tokens[ $stackPtr ]['content'] ) ) ) |
|
96 | + && ( \T_STRING !== $this->tokens[ $stackPtr ][ 'code' ] |
|
97 | + || 'new' !== strtolower( $this->tokens[ $stackPtr ][ 'content' ] ) ) ) |
|
98 | 98 | ) { |
99 | 99 | return; |
100 | 100 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | true |
111 | 111 | ); |
112 | 112 | |
113 | - if ( false !== $prev_non_empty && 'T_BITWISE_AND' === $this->tokens[ $prev_non_empty ]['type'] ) { |
|
113 | + if ( false !== $prev_non_empty && 'T_BITWISE_AND' === $this->tokens[ $prev_non_empty ][ 'type' ] ) { |
|
114 | 114 | $this->phpcsFile->recordMetric( $stackPtr, 'Assigning new by reference', 'yes' ); |
115 | 115 | |
116 | 116 | $this->phpcsFile->addError( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | // Walk back to the last part of the class name. |
144 | 144 | $has_comment = false; |
145 | 145 | for ( $classname_ptr = ( $next_non_empty_after_class_name - 1 ); $classname_ptr >= $stackPtr; $classname_ptr-- ) { |
146 | - if ( ! isset( Tokens::$emptyTokens[ $this->tokens[ $classname_ptr ]['code'] ] ) ) { |
|
146 | + if ( ! isset( Tokens::$emptyTokens[ $this->tokens[ $classname_ptr ][ 'code' ] ] ) ) { |
|
147 | 147 | // Prevent a false positive on variable variables, disregard them for now. |
148 | 148 | if ( $stackPtr === $classname_ptr ) { |
149 | 149 | return; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | break; |
153 | 153 | } |
154 | 154 | |
155 | - if ( \T_WHITESPACE !== $this->tokens[ $classname_ptr ]['code'] ) { |
|
155 | + if ( \T_WHITESPACE !== $this->tokens[ $classname_ptr ][ 'code' ] ) { |
|
156 | 156 | $has_comment = true; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $next_non_empty_after_class_name ]['code'] ) { |
|
160 | + if ( \T_OPEN_PARENTHESIS !== $this->tokens[ $next_non_empty_after_class_name ][ 'code' ] ) { |
|
161 | 161 | $this->phpcsFile->recordMetric( $stackPtr, 'Object instantiation with parenthesis', 'no' ); |
162 | 162 | |
163 | 163 | $fix = $this->phpcsFile->addFixableError( |
@@ -115,7 +115,7 @@ |
||
115 | 115 | /** |
116 | 116 | * Returns an array of tokens this test wants to listen for. |
117 | 117 | * |
118 | - * @return array |
|
118 | + * @return integer[] |
|
119 | 119 | */ |
120 | 120 | public function register() { |
121 | 121 | if ( \defined( '\PHP_CODESNIFFER_IN_TESTS' ) ) { |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | if ( \defined( '\T_PHPCS_DISABLE' ) && \defined( '\T_PHPCS_ENABLE' ) ) { |
149 | 149 | $i = -1; |
150 | 150 | while ( $i = $this->phpcsFile->findNext( \T_PHPCS_DISABLE, ( $i + 1 ) ) ) { |
151 | - if ( empty( $this->tokens[ $i ]['sniffCodes'] ) |
|
152 | - || isset( $this->tokens[ $i ]['sniffCodes']['WordPress'] ) |
|
153 | - || isset( $this->tokens[ $i ]['sniffCodes']['WordPress.Files'] ) |
|
154 | - || isset( $this->tokens[ $i ]['sniffCodes']['WordPress.Files.FileName'] ) |
|
151 | + if ( empty( $this->tokens[ $i ][ 'sniffCodes' ] ) |
|
152 | + || isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress' ] ) |
|
153 | + || isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress.Files' ] ) |
|
154 | + || isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress.Files.FileName' ] ) |
|
155 | 155 | ) { |
156 | 156 | do { |
157 | 157 | $i = $this->phpcsFile->findNext( \T_PHPCS_ENABLE, ( $i + 1 ) ); |
158 | 158 | } while ( false !== $i |
159 | - && ! empty( $this->tokens[ $i ]['sniffCodes'] ) |
|
160 | - && ! isset( $this->tokens[ $i ]['sniffCodes']['WordPress'] ) |
|
161 | - && ! isset( $this->tokens[ $i ]['sniffCodes']['WordPress.Files'] ) |
|
162 | - && ! isset( $this->tokens[ $i ]['sniffCodes']['WordPress.Files.FileName'] ) ); |
|
159 | + && ! empty( $this->tokens[ $i ][ 'sniffCodes' ] ) |
|
160 | + && ! isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress' ] ) |
|
161 | + && ! isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress.Files' ] ) |
|
162 | + && ! isset( $this->tokens[ $i ][ 'sniffCodes' ][ 'WordPress.Files.FileName' ] ) ); |
|
163 | 163 | |
164 | 164 | if ( false === $i ) { |
165 | 165 | // The entire (rest of the) file is disabled. |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | $fileName_end = substr( $fileName, -13 ); |
222 | 222 | $has_class = $this->phpcsFile->findNext( \T_CLASS, $stackPtr ); |
223 | 223 | |
224 | - if ( ( 'Template' === trim( $this->tokens[ $subpackage ]['content'] ) |
|
225 | - && $this->tokens[ $subpackage_tag ]['line'] === $this->tokens[ $subpackage ]['line'] ) |
|
224 | + if ( ( 'Template' === trim( $this->tokens[ $subpackage ][ 'content' ] ) |
|
225 | + && $this->tokens[ $subpackage_tag ][ 'line' ] === $this->tokens[ $subpackage ][ 'line' ] ) |
|
226 | 226 | && ( ( ! \defined( '\PHP_CODESNIFFER_IN_TESTS' ) && '-template.php' !== $fileName_end ) |
227 | 227 | || ( \defined( '\PHP_CODESNIFFER_IN_TESTS' ) && '-template.inc' !== $fileName_end ) ) |
228 | 228 | && false === $has_class |
@@ -155,7 +155,7 @@ |
||
155 | 155 | * |
156 | 156 | * @since 1.1.0 |
157 | 157 | * |
158 | - * @return array |
|
158 | + * @return string[] |
|
159 | 159 | */ |
160 | 160 | public function register() { |
161 | 161 | $this->empty_tokens = Tokens::$emptyTokens; |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | * Check if the error silencing is done for one of the whitelisted functions. |
185 | 185 | */ |
186 | 186 | $next_non_empty = $this->phpcsFile->findNext( $this->empty_tokens, ( $stackPtr + 1 ), null, true, null, true ); |
187 | - if ( false !== $next_non_empty && \T_STRING === $this->tokens[ $next_non_empty ]['code'] ) { |
|
187 | + if ( false !== $next_non_empty && \T_STRING === $this->tokens[ $next_non_empty ][ 'code' ] ) { |
|
188 | 188 | $has_parenthesis = $this->phpcsFile->findNext( Tokens::$emptyTokens, ( $next_non_empty + 1 ), null, true, null, true ); |
189 | - if ( false !== $has_parenthesis && \T_OPEN_PARENTHESIS === $this->tokens[ $has_parenthesis ]['code'] ) { |
|
190 | - $function_name = strtolower( $this->tokens[ $next_non_empty ]['content'] ); |
|
189 | + if ( false !== $has_parenthesis && \T_OPEN_PARENTHESIS === $this->tokens[ $has_parenthesis ][ 'code' ] ) { |
|
190 | + $function_name = strtolower( $this->tokens[ $next_non_empty ][ 'content' ] ); |
|
191 | 191 | if ( ( true === $this->use_default_whitelist |
192 | 192 | && isset( $this->function_whitelist[ $function_name ] ) === true ) |
193 | 193 | || in_array( $function_name, $this->custom_whitelist, true ) === true |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | - $this->context_length = (int) $this->context_length; |
|
202 | + $this->context_length = (int)$this->context_length; |
|
203 | 203 | $context_length = $this->context_length; |
204 | 204 | if ( $this->context_length <= 0 ) { |
205 | 205 | $context_length = 2; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $data = array(); |
218 | 218 | if ( $this->context_length > 0 ) { |
219 | 219 | $error_msg .= ' Found: %s'; |
220 | - $data[] = $found; |
|
220 | + $data[ ] = $found; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $this->phpcsFile->addWarning( |
@@ -62,7 +62,7 @@ |
||
62 | 62 | * @param mixed $val Assigned value. |
63 | 63 | * @param int $line Token line. |
64 | 64 | * @param array $group Group definition. |
65 | - * @return mixed FALSE if no match, TRUE if matches, STRING if matches |
|
65 | + * @return string|false FALSE if no match, TRUE if matches, STRING if matches |
|
66 | 66 | * with custom error message passed to ->process(). |
67 | 67 | */ |
68 | 68 | public function callback( $key, $val, $line, $group ) { |
@@ -66,7 +66,7 @@ |
||
66 | 66 | * with custom error message passed to ->process(). |
67 | 67 | */ |
68 | 68 | public function callback( $key, $val, $line, $group ) { |
69 | - $this->posts_per_page = (int) $this->posts_per_page; |
|
69 | + $this->posts_per_page = (int)$this->posts_per_page; |
|
70 | 70 | |
71 | 71 | if ( $val > $this->posts_per_page ) { |
72 | 72 | return 'Detected high pagination limit, `%s` is set to `%s`'; |
@@ -505,8 +505,8 @@ discard block |
||
505 | 505 | */ |
506 | 506 | private function get_php_version() { |
507 | 507 | |
508 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
509 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
508 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
509 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | */ |
519 | 519 | private function get_wordpress_version() { |
520 | 520 | |
521 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
522 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
521 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
522 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | */ |
532 | 532 | private function get_gravityforms_version() { |
533 | 533 | |
534 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
534 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
535 | 535 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
536 | 536 | |
537 | 537 | return null; |
538 | 538 | } |
539 | 539 | |
540 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
541 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
540 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
541 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $items = get_posts( array( |
585 | 585 | 'post_type' => 'gravityview', |
586 | 586 | 'post_status' => 'any', |
587 | - 'numberposts' => - 1, |
|
587 | + 'numberposts' => -1, |
|
588 | 588 | 'fields' => 'ids', |
589 | 589 | ) ); |
590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | $tables = array(); |
599 | 599 | |
600 | 600 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
601 | - $tables [] = \GFFormsModel::get_entry_meta_table_name(); |
|
601 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
602 | 602 | } elseif ( ! $this->is_GF_25() ) { |
603 | - $tables [] = \GFFormsModel::get_lead_meta_table_name(); |
|
603 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | foreach ( $tables as $meta_table ) { |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $tables = array(); |
620 | 620 | |
621 | 621 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
622 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
622 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
623 | 623 | } elseif ( ! $this->is_GF_25() ) { |
624 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
624 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |