|
19 | 19 | /** |
20 | 20 | * Enforces WordPress array spacing format. |
21 | 21 | * |
22 | | - * - Checks that associative arrays are multi-line. |
| 22 | + * - Checks that arrays with keys are multi-line. |
23 | 23 | * - Checks that each array item in a multi-line array starts on a new line. |
24 | 24 | * |
25 | 25 | * @link https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#indentation |
26 | 26 | * |
27 | 27 | * @since 0.11.0 - The WordPress specific additional checks have now been split off |
28 | 28 | * from the `WordPress.Arrays.ArrayDeclaration` sniff into this sniff. |
29 | | - * - Added sniffing & fixing for associative arrays. |
| 29 | + * - Added sniffing & fixing for arrays with keys. |
30 | 30 | * @since 0.12.0 Decoupled this sniff from the upstream sniff completely. |
31 | 31 | * This sniff now extends the WordPressCS native `Sniff` class instead. |
32 | 32 | * @since 0.13.0 Added the last remaining checks from the `WordPress.Arrays.ArrayDeclaration` |
33 | 33 | * sniff which were not covered elsewhere. |
34 | 34 | * The `WordPress.Arrays.ArrayDeclaration` sniff has now been deprecated. |
35 | 35 | * @since 0.13.0 Class name changed: this class is now namespaced. |
36 | | - * @since 0.14.0 Single item associative arrays are now by default exempt from the |
| 36 | + * @since 0.14.0 Single item arrays with keys are now by default exempt from the |
37 | 37 | * "must be multi-line" rule. This behavior can be changed using the |
38 | 38 | * `allow_single_item_single_line_associative_arrays` property. |
39 | 39 | * @since 3.0.0 Removed various whitespace related checks and fixers in favor of the PHPCSExtra |
|
42 | 42 | final class ArrayDeclarationSpacingSniff extends Sniff { |
43 | 43 |
|
44 | 44 | /** |
45 | | - * Whether or not to allow single item associative arrays to be single line. |
| 45 | + * Whether or not to allow single item arrays with keys to be single line. |
46 | 46 | * |
47 | 47 | * @since 0.14.0 |
48 | 48 | * |
@@ -102,7 +102,7 @@ public function process_token( $stackPtr ) { |
102 | 102 | } |
103 | 103 |
|
104 | 104 | /** |
105 | | - * Check that associative arrays are always multi-line. |
| 105 | + * Check that arrays with keys are always multi-line. |
106 | 106 | * |
107 | 107 | * @since 0.13.0 The actual checks contained in this method used to |
108 | 108 | * be in the `process()` method. |
@@ -137,9 +137,9 @@ protected function process_single_line_array( $stackPtr, $opener, $closer ) { |
137 | 137 | if ( false === $array_has_keys ) { |
138 | 138 | return; |
139 | 139 | } |
140 | | - $error = 'When an array uses associative keys, each value should start on %s.'; |
| 140 | + $error = 'When an array uses keys, each value should start on %s.'; |
141 | 141 | if ( true === $this->allow_single_item_single_line_associative_arrays ) { |
142 | | - $error = 'When a multi-item array uses associative keys, each value should start on %s.'; |
| 142 | + $error = 'When a multi-item array uses keys, each value should start on %s.'; |
143 | 143 | } |
144 | 144 |
|
145 | 145 | /* |
|
0 commit comments