Skip to content

Commit c7eae91

Browse files
committed
Arrays/ArrayDeclarationSpacing: minor test tweaks
1 parent 7c87f4f commit c7eae91

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

WordPress/Sniffs/Arrays/ArrayDeclarationSpacingSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ protected function process_multi_line_array( $stackPtr, $opener ) {
221221

222222
if ( false === $next ) {
223223
// Shouldn't happen, but just in case.
224-
$end_of_last_item = $end_of_this_item;
225-
continue;
224+
$end_of_last_item = $end_of_this_item; // @codeCoverageIgnore
225+
continue; // @codeCoverageIgnore
226226
}
227227

228228
if ( $this->tokens[ $next ]['line'] !== $this->tokens[ $first_content ]['line'] ) {
@@ -232,8 +232,8 @@ protected function process_multi_line_array( $stackPtr, $opener ) {
232232

233233
if ( false === $first_content ) {
234234
// Shouldn't happen, but just in case.
235-
$end_of_last_item = $end_of_this_item;
236-
continue;
235+
$end_of_last_item = $end_of_this_item; // @codeCoverageIgnore
236+
continue; // @codeCoverageIgnore
237237
}
238238

239239
if ( $this->tokens[ $end_of_last_item ]['line'] === $this->tokens[ $first_content ]['line'] ) {

WordPress/Tests/Arrays/ArrayDeclarationSpacingUnitTest.1.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ $bad = array(
8181

8282
// Don't confuse list arrows with array arrows.
8383
$okay = array( $item1, list( 'key1' => $a, 'key2' => $b ) = $array, $item3 );
84+
85+
// Live coding/parse error.
86+
// This must be the last test in the file!
87+
$ignore = array( $item1, 'key' => 'value',

WordPress/Tests/Arrays/ArrayDeclarationSpacingUnitTest.1.inc.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,7 @@ $bad = array(
134134

135135
// Don't confuse list arrows with array arrows.
136136
$okay = array( $item1, list( 'key1' => $a, 'key2' => $b ) = $array, $item3 );
137+
138+
// Live coding/parse error.
139+
// This must be the last test in the file!
140+
$ignore = array( $item1, 'key' => 'value',

0 commit comments

Comments
 (0)