diff --git a/src/Comment_Command.php b/src/Comment_Command.php index 766e28a5..ace5a9a6 100644 --- a/src/Comment_Command.php +++ b/src/Comment_Command.php @@ -63,6 +63,9 @@ public function __construct() { * # Create comment. * $ wp comment create --comment_post_ID=15 --comment_content="hello blog" --comment_author="wp-cli" * Success: Created comment 932. + * + * @param string[] $args Positional arguments. Unused. + * @param array $assoc_args Associative arguments. */ public function create( $args, $assoc_args ) { $assoc_args = wp_slash( $assoc_args ); @@ -110,6 +113,9 @@ function ( $params ) { * # Update comment. * $ wp comment update 123 --comment_author='That Guy' * Success: Updated comment 123. + * + * @param string[] $args Positional arguments. Comment IDs to update. + * @param array $assoc_args Associative arguments. */ public function update( $args, $assoc_args ) { $assoc_args = wp_slash( $assoc_args ); diff --git a/src/Term_Command.php b/src/Term_Command.php index 489ddf3e..79977bc0 100644 --- a/src/Term_Command.php +++ b/src/Term_Command.php @@ -142,8 +142,14 @@ public function list_( $args, $assoc_args ) { /** * @var \WP_Term[] $terms */ - // phpcs:ignore WordPress.WP.DeprecatedParameters.Get_termsParam2Found -- Required for backward compatibility. - $terms = get_terms( $args, $assoc_args ); + $terms = get_terms( + array_merge( + $assoc_args, + [ + 'taxonomy' => $args, + ] + ) + ); } $terms = array_map( @@ -211,7 +217,11 @@ public function create( $args, $assoc_args ) { $assoc_args = wp_slash( $assoc_args ); $term = wp_slash( $term ); - $result = wp_insert_term( $term, $taxonomy, $assoc_args ); + + /** + * @var string $term + */ + $result = wp_insert_term( $term, $taxonomy, $assoc_args ); if ( is_wp_error( $result ) ) { WP_CLI::error( $result->get_error_message() ); @@ -643,8 +653,13 @@ public function recount( $args ) { * @var \WP_Term[] $terms */ - // phpcs:ignore WordPress.WP.DeprecatedParameters.Get_termsParam2Found -- Required for backward compatibility. - $terms = get_terms( $taxonomy, [ 'hide_empty' => false ] ); + $terms = get_terms( + [ + 'taxonomy' => $taxonomy, + 'hide_empty' => false, + ] + ); + $term_taxonomy_ids = wp_list_pluck( $terms, 'term_taxonomy_id' ); wp_update_term_count( $term_taxonomy_ids, $taxonomy ); diff --git a/src/User_Command.php b/src/User_Command.php index 6a725687..2f45a33b 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -553,6 +553,9 @@ public function create( $args, $assoc_args ) { * # Update user * $ wp user update 123 --display_name=Mary --user_pass=marypass * Success: Updated user 123. + * + * @param string[] $args Positional arguments. Users to update. + * @param array $assoc_args Associative arguments. */ public function update( $args, $assoc_args ) { if ( isset( $assoc_args['user_login'] ) ) { diff --git a/src/WP_CLI/CommandWithMeta.php b/src/WP_CLI/CommandWithMeta.php index 2a5ac4b9..d3239199 100644 --- a/src/WP_CLI/CommandWithMeta.php +++ b/src/WP_CLI/CommandWithMeta.php @@ -314,6 +314,9 @@ public function update( $args, $assoc_args ) { $object_id = $this->check_object_id( $object_id ); + /** + * @var array|string $meta_value + */ $meta_value = sanitize_meta( $meta_key, $meta_value, $this->meta_type ); $old_value = sanitize_meta( $meta_key, $this->get_metadata( $object_id, $meta_key, true ), $this->meta_type ); @@ -454,6 +457,9 @@ function ( $key ) { WP_CLI::error( $exception->getMessage() ); } + /** + * @var array|string $patched_meta_value + */ $patched_meta_value = sanitize_meta( $meta_key, $traverser->value(), $this->meta_type ); if ( $patched_meta_value === $old_meta_value ) {