Skip to content

Commit af12525

Browse files
committed
Added missing unit tests for #3061
1 parent 1100d89 commit af12525

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,11 @@ public function processMultiLineArray($phpcsFile, $stackPtr, $arrayStart, $array
620620

621621
$valuePointer = $value['value'];
622622

623-
$ignoreTokens = ([
623+
$ignoreTokens = [
624624
T_WHITESPACE => T_WHITESPACE,
625625
T_COMMA => T_COMMA,
626-
] + Tokens::$castTokens);
626+
];
627+
$ignoreTokens += Tokens::$castTokens;
627628

628629
if ($tokens[$valuePointer]['code'] === T_CLOSURE) {
629630
$ignoreTokens += [T_STATIC => T_STATIC];

src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.1.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,19 @@ $c);
447447
array('a' => $a, 'b' => $b,
448448
'c' => $c);
449449

450+
array()
451+
static function() {
452+
return null;
453+
},
454+
(array) array(),
455+
(bool) array(),
456+
(double) array(),
457+
(int) array(),
458+
(object) array(),
459+
(string) array(),
460+
(unset) array(),
461+
);
462+
450463
// Intentional syntax error.
451464
$a = array(
452465
'a' =>

src/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.1.inc.fixed

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,19 @@ array(
483483
'c' => $c,
484484
);
485485

486+
array()
487+
static function() {
488+
return null;
489+
},
490+
(array) array(),
491+
(bool) array(),
492+
(double) array(),
493+
(int) array(),
494+
(object) array(),
495+
(string) array(),
496+
(unset) array(),
497+
);
498+
486499
// Intentional syntax error.
487500
$a = array(
488501
'a' =>

0 commit comments

Comments
 (0)