diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 9a82fcccc..5ce246aca 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -1216,6 +1216,10 @@ private function get_plugin_dependencies( $slug ) { return []; } + /** + * @var object{requires_plugins?: array} $api + */ + // Check if requires_plugins field exists and is not empty if ( ! empty( $api->requires_plugins ) && is_array( $api->requires_plugins ) ) { return $api->requires_plugins; diff --git a/src/WP_CLI/CommandWithUpgrade.php b/src/WP_CLI/CommandWithUpgrade.php index 63c7776e9..8326c168d 100755 --- a/src/WP_CLI/CommandWithUpgrade.php +++ b/src/WP_CLI/CommandWithUpgrade.php @@ -81,6 +81,9 @@ abstract protected function get_item_list(); */ abstract protected function filter_item_list( $items, $args ); + /** + * @return array + */ abstract protected function get_all_items(); /** @@ -237,6 +240,11 @@ public function install( $args, $assoc_args ) { && ! preg_match( '#github\.com/[^/]+/[^/]+/(?:releases/download|raw)/#', $slug ) ) { $filter = function ( $source ) use ( $slug ) { + /** + * @var \WP_Filesystem_Base $wp_filesystem + */ + global $wp_filesystem; + /** * @var string $path */ @@ -255,7 +263,7 @@ public function install( $args, $assoc_args ) { } $new_path = substr_replace( $source, $slug_dir, (int) strrpos( $source, $source_dir ), strlen( $source_dir ) ); - if ( $GLOBALS['wp_filesystem']->move( $source, $new_path ) ) { + if ( $wp_filesystem->move( $source, $new_path ) ) { WP_CLI::log( sprintf( "Renamed Github-based project from '%s' to '%s'.", $source_dir, $slug_dir ) ); return $new_path; } @@ -874,6 +882,9 @@ protected function _search( $args, $assoc_args ) { // In older WP versions these used to be objects. foreach ( $items as $index => $item_object ) { if ( is_array( $item_object ) ) { + /** + * @var array{slug: string} $item_object + */ $items[ $index ]['url'] = "https://wordpress.org/{$plural}/{$item_object['slug']}/"; } elseif ( $item_object instanceof \stdClass ) { $item_object->url = "https://wordpress.org/{$plural}/{$item_object->slug}/"; diff --git a/src/WP_CLI/ExtensionUpgraderSkin.php b/src/WP_CLI/ExtensionUpgraderSkin.php index 3c9db76ea..cef43ad27 100644 --- a/src/WP_CLI/ExtensionUpgraderSkin.php +++ b/src/WP_CLI/ExtensionUpgraderSkin.php @@ -8,6 +8,9 @@ * An Upgrader Skin for extensions (plugins/themes) that displays which item is being updated * * @package wp-cli + * + * @property-read array{Name?: string}|null $plugin_info + * @property-read \WP_Theme|null $theme_info */ class ExtensionUpgraderSkin extends UpgraderSkin { @@ -15,6 +18,7 @@ class ExtensionUpgraderSkin extends UpgraderSkin { * Called before an update is performed. */ public function before() { + // These properties are defined in `Bulk_Plugin_Upgrader_Skin`/`Bulk_Theme_Upgrader_Skin` if ( isset( $this->plugin_info ) && is_array( $this->plugin_info ) && isset( $this->plugin_info['Name'] ) ) { WP_CLI::log( sprintf( 'Updating %s...', html_entity_decode( $this->plugin_info['Name'], ENT_QUOTES, get_bloginfo( 'charset' ) ) ) ); } elseif ( isset( $this->theme_info ) && is_object( $this->theme_info ) && method_exists( $this->theme_info, 'get' ) ) { diff --git a/src/WP_CLI/ParseThemeNameInput.php b/src/WP_CLI/ParseThemeNameInput.php index 5a4def568..2c177f2fd 100644 --- a/src/WP_CLI/ParseThemeNameInput.php +++ b/src/WP_CLI/ParseThemeNameInput.php @@ -58,7 +58,7 @@ private function get_all_themes() { if ( is_multisite() ) { /** - * @var array} $site_enabled + * @var array $site_enabled */ $site_enabled = get_option( 'allowedthemes' ); if ( empty( $site_enabled ) ) { @@ -66,7 +66,7 @@ private function get_all_themes() { } /** - * @var array} $network_enabled + * @var array $network_enabled */ $network_enabled = get_site_option( 'allowedthemes' ); if ( empty( $network_enabled ) ) {