From e37cb96dd3eb957d4074865d3d84a1ede306c177 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 07:28:10 +0000 Subject: [PATCH 1/3] Update wp-cli/wp-cli-tests requirement from ^4 to ^5 Updates the requirements on [wp-cli/wp-cli-tests](https://github.com/wp-cli/wp-cli-tests) to permit the latest version. - [Release notes](https://github.com/wp-cli/wp-cli-tests/releases) - [Commits](https://github.com/wp-cli/wp-cli-tests/compare/v4.0.0...v5.0.0) --- updated-dependencies: - dependency-name: wp-cli/wp-cli-tests dependency-version: 5.0.0 dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9a9eefab..62667856 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "config": { "process-timeout": 7200, From 89a8c2dc62f68a5ba2a5036a88b5dbf414ec00a2 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 11:18:07 +0200 Subject: [PATCH 2/3] Update Composer config --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 62667856..783271d1 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "johnpbloch/wordpress-core-installer": true + "johnpbloch/wordpress-core-installer": true, + "phpstan/extension-installer": true }, "lock": false }, @@ -54,12 +55,14 @@ "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "phpcs": "run-phpcs-tests", + "phpstan": "run-phpstan-tests", "phpcbf": "run-phpcbf-cleanup", "phpunit": "run-php-unit-tests", "prepare-tests": "install-package-tests", "test": [ "@lint", "@phpcs", + "@phpstan", "@phpunit", "@behat" ] From c06e747b9be8663ab063cf37c221d0bda279fed0 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 11:18:21 +0200 Subject: [PATCH 3/3] PHPStan level 9 --- phpstan.neon.dist | 13 +++++++++++++ src/Super_Admin_Command.php | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..64d88315 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,13 @@ +parameters: + level: 9 + paths: + - src + - super-admin-command.php + scanDirectories: + - vendor/wp-cli/wp-cli/php + scanFiles: + - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php + treatPhpDocTypesAsCertain: false + ignoreErrors: + - identifier: missingType.parameter + - identifier: missingType.return diff --git a/src/Super_Admin_Command.php b/src/Super_Admin_Command.php index 55ecada5..b05dce35 100644 --- a/src/Super_Admin_Command.php +++ b/src/Super_Admin_Command.php @@ -24,10 +24,16 @@ */ class Super_Admin_Command extends WP_CLI_Command { + /** + * @var array + */ private $fields = [ 'user_login', ]; + /** + * @var \WP_CLI\Fetchers\User + */ private $fetcher; public function __construct() { @@ -84,6 +90,9 @@ public function list_subcommand( $_, $assoc_args ) { $user_ids = []; foreach ( $super_admins as $user_login ) { + /** + * @var \WP_User $user_obj + */ $user_obj = get_user_by( 'login', $user_login ); $user_ids[] = $user_obj->ID; }