From 47199e9aba4d7ebfae445aa88af95f83a681d4ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 00:14:59 +0000 Subject: [PATCH 1/5] 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 df06f7ca..0322aa32 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ }, "require-dev": { "wp-cli/extension-command": "^1.2 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "^5" }, "config": { "process-timeout": 7200, From 79dda70b1df45ca36d6db602f0bb8a2482fd8c01 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 10:45:54 +0200 Subject: [PATCH 2/5] Update Composer config --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0322aa32..587c2726 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 }, @@ -59,12 +60,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 aa2d899159b01c68a7aaa520037f8c79b058e99a Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 10:46:03 +0200 Subject: [PATCH 3/5] Update `testVersion` --- templates/.phpcs.xml.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/.phpcs.xml.dist b/templates/.phpcs.xml.dist index df58068d..8bbc9b37 100644 --- a/templates/.phpcs.xml.dist +++ b/templates/.phpcs.xml.dist @@ -18,7 +18,7 @@ - + From 1dc0d16a354910310086aa54878004d23fa105d3 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 10:46:17 +0200 Subject: [PATCH 4/5] PHPStan level 9 --- phpstan.neon.dist | 13 +++++++++++++ src/Scaffold_Command.php | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 phpstan.neon.dist diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..20dfba73 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,13 @@ +parameters: + level: 9 + paths: + - src + - scaffold-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/Scaffold_Command.php b/src/Scaffold_Command.php index d6d68545..e92a032e 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -875,7 +875,7 @@ private function scaffold_plugin_theme_tests( $args, $assoc_args, $type ) { $wp_versions_to_test = []; // Parse plugin readme.txt if ( file_exists( "{$target_dir}/readme.txt" ) ) { - $readme_content = file_get_contents( "{$target_dir}/readme.txt" ); + $readme_content = (string) file_get_contents( "{$target_dir}/readme.txt" ); preg_match( '/Requires at least\:(.*)\n/m', $readme_content, $matches ); if ( isset( $matches[1] ) && $matches[1] ) { @@ -1045,7 +1045,7 @@ protected function log_whether_files_written( $files_written, $skip_message, $su /** * Extracts dashicon name when provided or return null otherwise. * - * @param array $assoc_args + * @param array{dashicon?: string} $assoc_args * @return string|null */ private function extract_dashicon( $assoc_args ) { From 647942468d6add95c3e4a0d89eebe8c36d3ec2b0 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 4 Jul 2025 11:23:04 +0200 Subject: [PATCH 5/5] Update test --- features/scaffold.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/scaffold.feature b/features/scaffold.feature index e194ff31..57ee8f88 100644 --- a/features/scaffold.feature +++ b/features/scaffold.feature @@ -231,7 +231,7 @@ Feature: WordPress code scaffolding """ And the {PLUGIN_DIR}/hello-world/.phpcs.xml.dist file should contain: """ - + """ And the {PLUGIN_DIR}/hello-world/hello-world.php file should contain: """