-
Notifications
You must be signed in to change notification settings - Fork 26
Upgrade require szepeviktor/phpstan-wordpress
#298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade require szepeviktor/phpstan-wordpress
#298
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
PhpStan run failed: https://github.com/wp-cli/wp-cli-tests/actions/runs/21570736116/job/62149380938 Fixed in b2add61 by copying the full rule-set from phpstan-strict-rules/rules.neon@2.0.8. Allowing PhpStan 2 to be installed also allowed the newer version of Extra strict and opinionated rules for PHPStan to install, which then caused that issue. This PHPStan upgrade has caused its normal run to now fail: https://github.com/wp-cli/wp-cli-tests/actions/runs/21572281797/job/62153276858 |
The immediate call to `Utils\assoc_args_to_str()` handles `bool`, `array`, and anything `escapeshellarg()` can handle.
This is used for `send_to_shell` which is immediately unset if present.
|
I fixed six of the eight of the errors with two changes, explained in the commit messages. The two remaining, I'm not sure about: We can add Index: phpstan.neon.dist
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
--- a/phpstan.neon.dist (revision 2c2100ea9b55edf5220a5bef6138edd9631dc7e0)
+++ b/phpstan.neon.dist (date 1769989059654)
@@ -18,6 +18,7 @@
- WP_DEBUG
- WP_DEBUG_LOG
- WP_DEBUG_DISPLAY
+ reportUnmatchedIgnoredErrors: false
ignoreErrors:
# Needs fixing in WP-CLI.
- message: '#Parameter \#1 \$cmd of function WP_CLI\\Utils\\esc_cmd expects array<string>#'or Index: phpstan.neon.dist
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
--- a/phpstan.neon.dist (revision 2c2100ea9b55edf5220a5bef6138edd9631dc7e0)
+++ b/phpstan.neon.dist (date 1769989733706)
@@ -21,7 +21,6 @@
ignoreErrors:
# Needs fixing in WP-CLI.
- message: '#Parameter \#1 \$cmd of function WP_CLI\\Utils\\esc_cmd expects array<string>#'
- - message: '#Dynamic call to static method#'
path: 'tests/tests'
strictRules:
strictCalls: trueand for in /** @var ConstantBooleanType|ConstantStringType $returnOption */
$returnOption = new ConstantBooleanType( true );
/** @var ConstantBooleanType|ConstantStringType $parseOption */
$parseOption = new ConstantBooleanType( false );
/** @var ConstantBooleanType $exitOnErrorOption */
$exitOnErrorOption = new ConstantBooleanType( true );It looks intentional. Or could be fixed by removing the PhpDoc annotations altogether. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
swissspidy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
composer require szepeviktor/phpstan-wordpress:^v1.3.5 || ^v2.0.3wherev1.3.5was the existing requirement andv2.0.3is the latest release.Currently requiring
wp-cli/wp-cli-testsin a project that requiresszepeviktor/phpstan-wordpress:^2is not possible (except maybe with an ignore flag).szepeviktor/phpstan-wordpress:v2adds support forphpstan/phpstan:v2which is already allowed in this project's Composer.json.WordPress Extensions for PHPStan is not used directly in the project but is auto-loaded via phpstan/extension-installer, as configured in this project's Composer.json.
Conveniently,
szepeviktor/phpstan-wordpress:v2.0.3has some nice WP_CLI related changes.Two PHPUnit tests fail for me, but they also fail on
mainand on5.08:TestBehatTags::test_behat_tags_php_version()
TestBehatTags::test_behat_tags_extension()
I was trying to upgrade to address a Behat issue in a project so I'm hoping this is a local issue and CI will still pass.