Skip to content

Commit f293521

Browse files
committed
Merge branch 'main' into copilot/add-format-flag-to-update-commands
2 parents d92e45c + ab6cb0d commit f293521

14 files changed

+59
-24
lines changed

.github/workflows/code-quality.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- main
88
- master
9+
schedule:
10+
- cron: '17 2 * * *' # Run every day on a seemly random time.
911

1012
jobs:
1113
code-quality:

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"wp-cli/wp-cli": "^2.12"
15+
"wp-cli/wp-cli": "^2.13"
1616
},
1717
"require-dev": {
1818
"wp-cli/db-command": "^1.3 || ^2",

features/language-plugin.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Feature: Manage plugin translation files for a WordPress install
1919
| language | english_name | status |
2020
| cs_CZ | Czech | uninstalled |
2121
| de_DE | German | uninstalled |
22-
| en_US | English (United States) | active |
2322
| en_GB | English (UK) | uninstalled |
2423

2524
When I try `wp language plugin list not-a-plugin --format=json`
@@ -87,15 +86,13 @@ Feature: Manage plugin translation files for a WordPress install
8786
| language | english_name | status |
8887
| cs_CZ | Czech | installed |
8988
| de_DE | German | installed |
90-
| en_US | English (United States) | active |
9189
| en_GB | English (UK) | installed |
9290

9391
When I run `wp language plugin list hello-dolly --fields=language,english_name,update`
9492
Then STDOUT should be a table containing rows:
9593
| language | english_name | update |
9694
| cs_CZ | Czech | none |
9795
| de_DE | German | none |
98-
| en_US | English (United States) | none |
9996
| en_GB | English (UK) | none |
10097

10198
When I run `wp language plugin list hello-dolly --status=installed --format=count`

features/language-theme.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Feature: Manage theme translation files for a WordPress install
1616
| language | english_name | status |
1717
| cs_CZ | Czech | uninstalled |
1818
| de_DE | German | uninstalled |
19-
| en_US | English (United States) | active |
2019
| en_GB | English (UK) | uninstalled |
2120

2221
When I try `wp language theme list not-a-theme --format=json`
@@ -85,7 +84,6 @@ Feature: Manage theme translation files for a WordPress install
8584
| cs_CZ | Czech | installed |
8685
| de_DE | German | installed |
8786
| en_GB | English (UK) | installed |
88-
| en_US | English (United States) | active |
8987

9088
When I run `wp language theme list twentyten --fields=language,english_name,update`
9189
Then STDOUT should be a table containing rows:
@@ -119,7 +117,6 @@ Feature: Manage theme translation files for a WordPress install
119117
| language | english_name | status |
120118
| cs_CZ | Czech | installed |
121119
| de_DE | German | installed |
122-
| en_US | English (United States) | installed |
123120
| en_GB | English (UK) | active |
124121

125122
When I run `wp language theme uninstall twentyten cs_CZ de_DE`

phpcs.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,7 @@
8383
<exclude-pattern>*/src/Language_Namespace\.php$</exclude-pattern>
8484
</rule>
8585

86+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
87+
<exclude-pattern>*/tests/phpstan</exclude-pattern>
88+
</rule>
8689
</ruleset>

phpstan.neon.dist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
- vendor/wp-cli/wp-cli/php
88
scanFiles:
99
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
10+
- tests/phpstan/scan-files.php
1011
treatPhpDocTypesAsCertain: false
1112
strictRules:
1213
uselessCast: true
@@ -16,7 +17,4 @@ parameters:
1617
numericOperandsInArithmeticOperators: true
1718
switchConditionsMatchingType: true
1819
ignoreErrors:
19-
- identifier: missingType.iterableValue
20-
- identifier: missingType.property
21-
- identifier: missingType.parameter
2220
- identifier: missingType.return

src/Core_Language_Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ public function activate( $args ) {
398398
$this->activate_language( $language_code );
399399
}
400400

401+
/**
402+
* @param string $language_code
403+
*/
401404
private function activate_language( $language_code ) {
402405
$available = $this->get_installed_languages();
403406

src/Plugin_Language_Command.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,18 @@ public function install( $args, $assoc_args ) {
263263
if ( $all ) {
264264
$this->install_many( $args, $assoc_args );
265265
} else {
266+
/**
267+
* @var non-empty-list<string> $args
268+
*/
266269
$this->install_one( $args, $assoc_args );
267270
}
268271
}
269272

270273
/**
271274
* Installs translations for a plugin.
272275
*
273-
* @param array $args Runtime arguments.
274-
* @param array $assoc_args Runtime arguments.
276+
* @param non-empty-list<string> $args Positional arguments.
277+
* @param array{all?: bool, format: string} $assoc_args Associative arguments.
275278
*/
276279
private function install_one( $args, $assoc_args ) {
277280
$plugin = array_shift( $args );
@@ -314,8 +317,8 @@ private function install_one( $args, $assoc_args ) {
314317
/**
315318
* Installs translations for all installed plugins.
316319
*
317-
* @param array $args Runtime arguments.
318-
* @param array $assoc_args Runtime arguments.
320+
* @param string[] $args Positional arguments.
321+
* @param array{all?: bool, format: string} $assoc_args Associative arguments.
319322
*/
320323
private function install_many( $args, $assoc_args ) {
321324
$language_codes = (array) $args;
@@ -639,7 +642,7 @@ public function update( $args, $assoc_args ) {
639642
* Uses the same filter core uses in plugins.php to determine which plugins
640643
* should be available to manage through the WP_Plugins_List_Table class.
641644
*
642-
* @return array
645+
* @return array<string, array{Name: string}>
643646
*/
644647
private function get_all_plugins() {
645648
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Using WP native hook.

src/Site_Switch_Language_Command.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class Site_Switch_Language_Command extends WP_CLI\CommandWithTranslation {
1717
* Success: Language activated.
1818
*
1919
* @throws WP_CLI\ExitException
20+
*
21+
* @param array{0: string} $args Positional arguments.
22+
* @param array<mixed> $assoc_args Associative arguments.
2023
*/
2124
public function __invoke( $args, $assoc_args ) {
2225
list( $language_code ) = $args;

0 commit comments

Comments
 (0)