Skip to content

Commit 1c11924

Browse files
committed
More consistent signaturs & type hints
1 parent 1975695 commit 1c11924

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/Plugin_AutoUpdates_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function __construct() {
7373
* Plugin auto-updates for 'hello' enabled.
7474
* Success: Enabled 1 of 1 plugin auto-updates.
7575
*
76-
* @param array $args
77-
* @param array $assoc_args
76+
* @param string[] $args Positional arguments.
77+
* @param array{all?: bool, 'disabled-only'?: bool} $assoc_args Associative arguments.
7878
*/
7979
public function enable( $args, $assoc_args ) {
8080
$all = (bool) Utils\get_flag_value( $assoc_args, 'all', false );

src/Theme_Mod_Command.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ class Theme_Mod_Command extends WP_CLI_Command {
7474
* | background_color | dd3333 |
7575
* | header_textcolor | |
7676
* +------------------+--------+
77+
*
78+
* @param string[] $args Positional arguments.
79+
* @param array{field?: string, all?: bool, format: string} $assoc_args Associative arguments.
7780
*/
78-
public function get( $args = array(), $assoc_args = array() ) {
81+
public function get( $args, $assoc_args ) {
7982

8083
if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
8184
WP_CLI::error( 'You must specify at least one mod or use --all.' );
@@ -162,10 +165,13 @@ public function get( $args = array(), $assoc_args = array() ) {
162165
* +------------------+---------+
163166
*
164167
* @subcommand list
168+
*
169+
* @param string[] $args Positional arguments. Unused.
170+
* @param array{field?: string, format: string} $assoc_args Associative arguments.
165171
*/
166-
public function list_( $args = array(), $assoc_args = array() ) {
172+
public function list_( $args, $assoc_args ) {
167173

168-
$assoc_args['all'] = 1;
174+
$assoc_args['all'] = true;
169175

170176
$this->get( $args, $assoc_args );
171177
}
@@ -194,8 +200,11 @@ public function list_( $args = array(), $assoc_args = array() ) {
194200
* # Remove multiple theme mods.
195201
* $ wp theme mod remove background_color header_textcolor
196202
* Success: 2 mods removed.
203+
*
204+
* @param string[] $args Positional arguments.
205+
* @param array{all?: bool} $assoc_args Associative arguments.
197206
*/
198-
public function remove( $args = array(), $assoc_args = array() ) {
207+
public function remove( $args, $assoc_args, ) {
199208

200209
if ( ! \WP_CLI\Utils\get_flag_value( $assoc_args, 'all' ) && empty( $args ) ) {
201210
WP_CLI::error( 'You must specify at least one mod or use --all.' );
@@ -233,10 +242,10 @@ public function remove( $args = array(), $assoc_args = array() ) {
233242
* $ wp theme mod set background_color 000000
234243
* Success: Theme mod background_color set to 000000.
235244
*
236-
* @param string[] $args
237-
* @param array $assoc_args
245+
* @param array{0: string, 1: string} $args Positional arguments.
246+
* @param array $assoc_args Associative arguments. Unused.
238247
*/
239-
public function set( $args = array(), $assoc_args = array() ) {
248+
public function set( $args, $assoc_args ) {
240249
list( $mod, $value ) = $args;
241250

242251
set_theme_mod( $mod, $value );

0 commit comments

Comments
 (0)