Apply suggestions from code review

Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
This commit is contained in:
Pascal Birchler 2025-06-11 11:15:11 +02:00 committed by GitHub
parent 1975695dd1
commit f7d3b4c190
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -1276,7 +1276,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade {
/**
* @var callable $callback
*/
$callback = array( $wp_filesystem, 'delete' );
$callback = [ $wp_filesystem, 'delete' ];
array_map( $callback, $json_translation_files );
}
}

View file

@ -203,7 +203,7 @@ abstract class CommandWithUpgrade extends \WP_CLI_Command {

$filter = false;
// If a GitHub URL, do some guessing as to the correct plugin/theme directory.
if ( $is_remote && 'github.com' === \WP_CLI\Utils\parse_url( $slug, PHP_URL_HOST )
if ( $is_remote && 'github.com' === Utils\parse_url( $slug, PHP_URL_HOST )
// Don't attempt to rename ZIPs uploaded to the releases page or coming from a raw source.
&& ! preg_match( '#github\.com/[^/]+/[^/]+/(?:releases/download|raw)/#', $slug ) ) {

@ -211,7 +211,7 @@ abstract class CommandWithUpgrade extends \WP_CLI_Command {
/**
* @var string $path
*/
$path = \WP_CLI\Utils\parse_url( $slug, PHP_URL_PATH );
$path = Utils\parse_url( $slug, PHP_URL_PATH );
$slug_dir = Utils\basename( $path, '.zip' );

// Don't use the zip name if archive attached to release, as name likely to contain version tag/branch.