Skip to content

Commit 54c2ae5

Browse files
committed
Drop the comment_meta workaround now that upstream is fixed
wp-cli/wp-cli#6393 corrected parse_shell_arrays()'s $assoc_args parameter to array<string, mixed>, which is what it always accepted. The local wrapper existed only to work around the previous annotation, so revert to the plain call and let all four call sites in this repo look the same again. This does not need to wait for a wp-cli release: composer.json sets minimum-stability to dev and requires ^3.0, which resolves to dev-main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014SSZzqMJRDTiLiDxQEPYcL
1 parent 72daaa2 commit 54c2ae5

1 file changed

Lines changed: 2 additions & 28 deletions

File tree

‎src/Comment_Command.php‎

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,6 @@ public function __construct() {
7575
$this->fetcher = new CommentFetcher();
7676
}
7777

78-
/**
79-
* Decodes the `--comment_meta` argument from its JSON representation.
80-
*
81-
* Utils\parse_shell_arrays() is typed for string values throughout, while
82-
* comment arguments are not, so narrow to the single key it needs to see.
83-
* It only ever acts on strings anyway, since is_json() rejects everything
84-
* else.
85-
*
86-
* @param array<string, mixed> $assoc_args Associative arguments.
87-
* @return array<string, mixed> Associative arguments, with comment_meta decoded.
88-
*/
89-
private static function parse_comment_meta( $assoc_args ) {
90-
if ( ! isset( $assoc_args['comment_meta'] ) || ! is_string( $assoc_args['comment_meta'] ) ) {
91-
return $assoc_args;
92-
}
93-
94-
$parsed = Utils\parse_shell_arrays(
95-
[ 'comment_meta' => $assoc_args['comment_meta'] ],
96-
[ 'comment_meta' ]
97-
);
98-
99-
$assoc_args['comment_meta'] = $parsed['comment_meta'];
100-
101-
return $assoc_args;
102-
}
103-
10478
/**
10579
* Creates a new comment.
10680
*
@@ -171,7 +145,7 @@ private static function parse_comment_meta( $assoc_args ) {
171145
* @param array<string, mixed> $assoc_args Associative arguments.
172146
*/
173147
public function create( $args, $assoc_args ) {
174-
$assoc_args = self::parse_comment_meta( $assoc_args );
148+
$assoc_args = Utils\parse_shell_arrays( $assoc_args, [ 'comment_meta' ] );
175149

176150
$assoc_args = wp_slash( $assoc_args );
177151
parent::_create(
@@ -269,7 +243,7 @@ function ( $params ) {
269243
* @param array<string, mixed> $assoc_args Associative arguments.
270244
*/
271245
public function update( $args, $assoc_args ) {
272-
$assoc_args = self::parse_comment_meta( $assoc_args );
246+
$assoc_args = Utils\parse_shell_arrays( $assoc_args, [ 'comment_meta' ] );
273247

274248
$assoc_args = wp_slash( $assoc_args );
275249
parent::_update(

0 commit comments

Comments
 (0)