Skip to content

Commit d02a92c

Browse files
authored
Fix PHPStan errors with WordPress 7.1 stubs (#544)
1 parent fc7965d commit d02a92c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/WP_CLI/ExtensionUpgraderSkin.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ public function before() {
2222
if ( isset( $this->plugin_info ) && is_array( $this->plugin_info ) && isset( $this->plugin_info['Name'] ) ) {
2323
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->plugin_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
2424
} elseif ( isset( $this->theme_info ) && is_object( $this->theme_info ) && method_exists( $this->theme_info, 'get' ) ) {
25-
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->theme_info->get( 'Name' ), ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
25+
$theme_name = $this->theme_info->get( 'Name' );
26+
27+
if ( false !== $theme_name ) {
28+
WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $theme_name, ENT_QUOTES, get_bloginfo( 'charset' ) ) ) );
29+
}
2630
}
2731
}
2832
}

src/WP_CLI/ParseThemeNameInput.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ private function get_all_themes() {
138138
$theme_type = 'block';
139139
}
140140

141+
$description = $theme->get( 'Description' );
142+
141143
$items[ $stylesheet ] = [
142144
'name' => $key,
143145
'status' => $this->get_status( $theme ),
@@ -147,7 +149,7 @@ private function get_all_themes() {
147149
'version' => $theme->get( 'Version' ),
148150
'update_id' => $stylesheet,
149151
'title' => $theme->get( 'Name' ),
150-
'description' => wordwrap( $theme->get( 'Description' ) ),
152+
'description' => false !== $description ? wordwrap( $description ) : '',
151153
'author' => $theme->get( 'Author' ),
152154
'auto_update' => in_array( $stylesheet, $auto_updates, true ),
153155
'auto_update_indicated' => $auto_update_indicated,

0 commit comments

Comments
 (0)