Skip to content

Commit bd07143

Browse files
committed
Lint fixes
1 parent 7ff3625 commit bd07143

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
<exclude-pattern>*/src/Site(_Meta|_Option)?_Command\.php$</exclude-pattern>
7070
<exclude-pattern>*/src/Term(_Meta)?_Command\.php$</exclude-pattern>
7171
<exclude-pattern>*/src/User(_Application_Password|_Meta|_Session|_Term)?_Command\.php$</exclude-pattern>
72+
<exclude-pattern>*/src/Block_Command\.php$</exclude-pattern>
73+
<exclude-pattern>*/src/Pattern_Command\.php$</exclude-pattern>
7274
</rule>
7375

7476
<!-- Whitelisting to provide backward compatibility to classes possibly extending this class. -->

src/Block_Command.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
*/
2727
class Block_Command extends WP_CLI_Command {
2828

29-
private $fields = array(
29+
private $fields = [
3030
'name',
3131
'title',
3232
'description',
3333
'category',
34-
);
34+
];
3535

3636
/**
3737
* Lists registered block types.
@@ -102,7 +102,7 @@ public function list_( $args, $assoc_args ) {
102102
$registry = WP_Block_Type_Registry::get_instance();
103103
$blocks = $registry->get_all_registered();
104104

105-
$items = array();
105+
$items = [];
106106
foreach ( $blocks as $block ) {
107107
$items[] = $this->prepare_block_for_output( $block );
108108
}
@@ -187,24 +187,24 @@ public function get( $args, $assoc_args ) {
187187
* @return array Prepared block data.
188188
*/
189189
private function prepare_block_for_output( $block ) {
190-
return array(
190+
return [
191191
'name' => $block->name,
192-
'title' => $block->title ?? '',
193-
'description' => $block->description ?? '',
192+
'title' => $block->title ?? '', // @phpstan-ignore-line (added in WP 5.5)
193+
'description' => $block->description ?? '', // @phpstan-ignore-line (added in WP 5.5)
194194
'category' => $block->category ?? '',
195195
'parent' => $block->parent ?? null,
196196
'icon' => $block->icon ?? '',
197-
'keywords' => $block->keywords ?? array(),
197+
'keywords' => $block->keywords ?? [], // @phpstan-ignore-line (added in WP 5.5)
198198
'textdomain' => $block->textdomain ?? '',
199-
'supports' => $block->supports ?? array(),
200-
'styles' => $block->styles ?? array(),
201-
'variations' => $block->variations ?? array(),
202-
'api_version' => $block->api_version ?? 1,
199+
'supports' => $block->supports ?? [],
200+
'styles' => $block->styles ?? [], // @phpstan-ignore-line (added in WP 5.5)
201+
'variations' => $block->variations ?? [], // added in WP 5.8 and replaced with magic getter in 6.1
202+
'api_version' => $block->api_version ?? 1, // @phpstan-ignore-line (added in WP 5.6)
203203
'editor_script' => $block->editor_script ?? '',
204204
'editor_style' => $block->editor_style ?? '',
205205
'script' => $block->script ?? '',
206206
'style' => $block->style ?? '',
207-
);
207+
];
208208
}
209209

210210
/**

0 commit comments

Comments
 (0)