File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,11 @@ public function execute( $args, $assoc_args ) {
298298 }
299299 }
300300
301+ /**
302+ * Existence is checked above with wp_has_ability().
303+ *
304+ * @var \WP_Ability $ability
305+ */
301306 $ ability = wp_get_ability ( $ ability_name );
302307
303308 $ result = $ ability ->execute ( $ input );
@@ -310,10 +315,10 @@ public function execute( $args, $assoc_args ) {
310315 $ format = isset ( $ assoc_args ['format ' ] ) ? $ assoc_args ['format ' ] : 'json ' ;
311316
312317 if ( 'json ' === $ format ) {
313- WP_CLI ::line ( wp_json_encode ( $ result , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) );
318+ WP_CLI ::line ( ( string ) wp_json_encode ( $ result , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) );
314319 } elseif ( 'yaml ' === $ format ) {
315320 // Convert to YAML-like output
316- foreach ( $ result as $ key => $ value ) {
321+ foreach ( ( array ) $ result as $ key => $ value ) {
317322 if ( is_array ( $ value ) || is_object ( $ value ) ) {
318323 WP_CLI ::line ( $ key . ': ' . wp_json_encode ( $ value ) );
319324 } else {
You can’t perform that action at this time.
0 commit comments