Skip to content

Commit 946c2e2

Browse files
authored
Fix newly reported PHPStan errors (#341)
1 parent fe10efb commit 946c2e2

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎src/Core_Command.php‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function download( $args, $assoc_args ) {
213213
WP_CLI::error( 'Cannot use both --skip-content and --no-extract at the same time.' );
214214
}
215215

216-
$download_url = array_shift( $args );
216+
$download_url = (string) array_shift( $args );
217217
$from_url = ! empty( $download_url );
218218

219219
if ( $from_url ) {
@@ -225,7 +225,7 @@ public function download( $args, $assoc_args ) {
225225
WP_CLI::error( 'Skip content and locale options are not available for URL downloads.' );
226226
}
227227
} elseif ( isset( $assoc_args['version'] ) && 'latest' !== $assoc_args['version'] ) {
228-
$version = $assoc_args['version'];
228+
$version = (string) $assoc_args['version'];
229229
if ( in_array( strtolower( $version ), [ 'trunk', 'nightly' ], true ) ) {
230230
$version = 'nightly';
231231
}
@@ -249,6 +249,7 @@ public function download( $args, $assoc_args ) {
249249
WP_CLI::error( "The requested locale ({$locale}) was not found." );
250250
}
251251
}
252+
/** @var array{current: string, download: string} $offer */
252253
$version = $offer['current'];
253254
$download_url = $offer['download'];
254255
}
@@ -1946,10 +1947,10 @@ private function capture_version_check_error_from_response( $response, $context,
19461947
/**
19471948
* Clean up extra files.
19481949
*
1949-
* @param string $version_from Starting version that the installation was updated from.
1950-
* @param string $version_to Target version that the installation is updated to.
1951-
* @param string $locale Locale of the installation.
1952-
* @param bool $insecure Whether to retry without certificate validation on TLS handshake failure.
1950+
* @param string|null $version_from Starting version that the installation was updated from.
1951+
* @param string|null $version_to Target version that the installation is updated to.
1952+
* @param string $locale Locale of the installation.
1953+
* @param bool $insecure Whether to retry without certificate validation on TLS handshake failure.
19531954
*/
19541955
private function cleanup_extra_files( $version_from, $version_to, $locale, $insecure ) {
19551956
if ( ! $version_from || ! $version_to ) {

0 commit comments

Comments
 (0)