Skip to content

Commit ee75525

Browse files
committed
PHPStan fixes
1 parent ae13d9c commit ee75525

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/WP_CLI/CommandWithUpgrade.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,11 @@ function ( $item ) {
555555
remove_filter( 'site_transient_' . $this->upgrade_transient, $transient_filter, 999 );
556556
}
557557

558+
if ( ! is_array( $result ) ) {
559+
// This should never happen, but bulk_upgrade() can return false.
560+
WP_CLI::error( 'Plugin upgrader is unable to connect to the filesystem.' );
561+
}
562+
558563
/**
559564
* @var array $items_to_update
560565
*/
@@ -609,7 +614,9 @@ static function ( $result ) {
609614
WP_CLI::log( "Skipped updates for: $exclude" );
610615
}
611616

612-
WP_CLI::do_hook( "{$this->item_type}_update_finished", $upgrader->get_changed_files() );
617+
if ( isset( $upgrader ) ) {
618+
WP_CLI::do_hook( "{$this->item_type}_update_finished", $upgrader->get_changed_files() );
619+
}
613620
}
614621

615622
// phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore -- Whitelisting to provide backward compatibility to classes possibly extending this class.

0 commit comments

Comments
 (0)