From ba629d7e964cbb9011c7e04deebcf28df84142e7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 15:10:21 +0000 Subject: [PATCH] Fix PHPStan errors by passing explicit false default to get_flag_value() Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NDYX767HJCpR3xuCfhBTDm --- src/Media_Command.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Media_Command.php b/src/Media_Command.php index 6f95308c..4c3391b7 100644 --- a/src/Media_Command.php +++ b/src/Media_Command.php @@ -178,18 +178,18 @@ public function regenerate( $args, $assoc_args = array() ) { } } - $skip_delete = Utils\get_flag_value( $assoc_args, 'skip-delete' ); - $only_missing = Utils\get_flag_value( $assoc_args, 'only-missing' ); + $skip_delete = Utils\get_flag_value( $assoc_args, 'skip-delete', false ); + $only_missing = Utils\get_flag_value( $assoc_args, 'only-missing', false ); if ( $only_missing ) { $skip_delete = true; } - $delete_unknown = Utils\get_flag_value( $assoc_args, 'delete-unknown' ); + $delete_unknown = Utils\get_flag_value( $assoc_args, 'delete-unknown', false ); if ( $delete_unknown ) { $skip_delete = false; } - $update_attachment_refs = Utils\get_flag_value( $assoc_args, 'update-attachment-refs' ); + $update_attachment_refs = Utils\get_flag_value( $assoc_args, 'update-attachment-refs', false ); $additional_mime_types = array(); @@ -316,7 +316,7 @@ public function prune( $args, $assoc_args = array() ) { } } - $remove_abandoned = Utils\get_flag_value( $assoc_args, 'remove-abandoned' ); + $remove_abandoned = Utils\get_flag_value( $assoc_args, 'remove-abandoned', false ); if ( empty( $args ) ) { if ( $image_sizes ) { @@ -910,7 +910,7 @@ public function replace( $args, $assoc_args = array() ) { $new_mime_type = $uploaded['type']; // Delete old thumbnail files unless asked to skip. - if ( ! Utils\get_flag_value( $assoc_args, 'skip-delete' ) + if ( ! Utils\get_flag_value( $assoc_args, 'skip-delete', false ) && false !== $old_fullsizepath && is_array( $old_metadata ) ) { @@ -2055,7 +2055,7 @@ public function fix_orientation( $args, $assoc_args ) { $images = $this->get_images( $args ); $posts = $images->posts; $count = $images->post_count; - $dry_run = Utils\get_flag_value( $assoc_args, 'dry-run' ); + $dry_run = Utils\get_flag_value( $assoc_args, 'dry-run', false ); if ( ! $count || ! is_array( $posts ) ) { WP_CLI::error( 'No images found.' );