@@ -103,6 +103,9 @@ class Theme_Language_Command extends WP_CLI\CommandWithTranslation {
103103 * | az | Azerbaijani | uninstalled |
104104 *
105105 * @subcommand list
106+ *
107+ * @param string[] $args Positional arguments.
108+ * @param array{all?: bool, field?: string, format: string, theme?: string, language?: string, english_name?: string, native_name?: string, status?: string, update?: string, updated?: string} $assoc_args Associative arguments.
106109 */
107110 public function list_ ( $ args , $ assoc_args ) {
108111 $ all = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'all ' , false );
@@ -194,8 +197,10 @@ function ( $file ) {
194197 * 1
195198 *
196199 * @subcommand is-installed
200+ *
201+ * @param non-empty-array<string> $args Positional arguments.
197202 */
198- public function is_installed ( $ args, $ assoc_args = array () ) {
203+ public function is_installed ( $ args ) {
199204 $ theme = array_shift ( $ args );
200205 $ language_codes = (array ) $ args ;
201206
@@ -249,6 +254,9 @@ public function is_installed( $args, $assoc_args = array() ) {
249254 * Success: Installed 1 of 1 languages.
250255 *
251256 * @subcommand install
257+ *
258+ * @param string[] $args Positional arguments.
259+ * @param array{all?: bool, format: string} $assoc_args Associative arguments.
252260 */
253261 public function install ( $ args , $ assoc_args ) {
254262 $ all = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'all ' , false );
@@ -272,7 +280,7 @@ public function install( $args, $assoc_args ) {
272280 */
273281 private function install_one ( $ args , $ assoc_args ) {
274282 $ theme = array_shift ( $ args );
275- $ language_codes = ( array ) $ args ;
283+ $ language_codes = $ args ;
276284 $ count = count ( $ language_codes );
277285
278286 $ available = $ this ->get_installed_languages ( $ theme );
@@ -315,7 +323,11 @@ private function install_one( $args, $assoc_args ) {
315323 */
316324 private function install_many ( $ args , $ assoc_args ) {
317325 $ language_codes = (array ) $ args ;
318- $ themes = wp_get_themes ();
326+
327+ /**
328+ * @var \WP_Theme[] $themes
329+ */
330+ $ themes = wp_get_themes ();
319331
320332 if ( empty ( $ assoc_args ['format ' ] ) ) {
321333 $ assoc_args ['format ' ] = 'table ' ;
@@ -343,22 +355,27 @@ private function install_many( $args, $assoc_args ) {
343355
344356 $ available = $ this ->get_installed_languages ( $ theme_name );
345357
358+ /**
359+ * @var string $display_name
360+ */
361+ $ display_name = $ theme_details ['Name ' ];
362+
346363 foreach ( $ language_codes as $ language_code ) {
347364 $ result = [
348365 'name ' => $ theme_name ,
349366 'locale ' => $ language_code ,
350367 ];
351368
352369 if ( in_array ( $ language_code , $ available , true ) ) {
353- \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ theme_details [ ' Name ' ] }' already installed. " );
370+ \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ display_name }' already installed. " );
354371 $ result ['status ' ] = 'already installed ' ;
355372 ++$ skips ;
356373 } else {
357374 $ response = $ this ->download_language_pack ( $ language_code , $ theme_name );
358375
359376 if ( is_wp_error ( $ response ) ) {
360377 \WP_CLI ::warning ( $ response );
361- \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ theme_details [ ' Name ' ] }' not installed. " );
378+ \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ display_name }' not installed. " );
362379
363380 if ( 'not_found ' === $ response ->get_error_code () ) {
364381 $ result ['status ' ] = 'not available ' ;
@@ -368,7 +385,7 @@ private function install_many( $args, $assoc_args ) {
368385 ++$ errors ;
369386 }
370387 } else {
371- \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ theme_details [ ' Name ' ] }' installed. " );
388+ \WP_CLI ::log ( "Language ' {$ language_code }' for ' {$ display_name }' installed. " );
372389 $ result ['status ' ] = 'installed ' ;
373390 ++$ successes ;
374391 }
@@ -423,6 +440,9 @@ private function install_many( $args, $assoc_args ) {
423440 * Success: Uninstalled 1 of 1 languages.
424441 *
425442 * @subcommand uninstall
443+ *
444+ * @param string[] $args Positional arguments.
445+ * @param array{all?: bool, format: string} $assoc_args Associative arguments.
426446 */
427447 public function uninstall ( $ args , $ assoc_args ) {
428448 /** @var WP_Filesystem_Base $wp_filesystem */
@@ -481,6 +501,9 @@ public function uninstall( $args, $assoc_args ) {
481501 // As of WP 4.0, no API for deleting a language pack
482502 WP_Filesystem ();
483503
504+ /**
505+ * @var string $theme
506+ */
484507 foreach ( $ process_themes as $ theme ) {
485508 $ available_languages = $ this ->get_installed_languages ( $ theme );
486509
@@ -594,6 +617,9 @@ public function uninstall( $args, $assoc_args ) {
594617 * Success: Updated 1/1 translation.
595618 *
596619 * @subcommand update
620+ *
621+ * @param string[] $args Positional arguments.
622+ * @param array{'dry-run'?: bool, all?: bool} $assoc_args Associative arguments.
597623 */
598624 public function update ( $ args , $ assoc_args ) {
599625 $ all = \WP_CLI \Utils \get_flag_value ( $ assoc_args , 'all ' , false );
0 commit comments