Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"wp-cli/wp-cli": "^2.12"
"wp-cli/wp-cli": "^2.13"
},
"require-dev": {
"wp-cli/wp-cli-tests": "^5"
Expand Down
2 changes: 2 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
<exclude-pattern>*/src/(Role|Capabilities)_Command\.php$</exclude-pattern>
</rule>

<exclude-pattern>/tests/phpstan/scan-files</exclude-pattern>
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpcs.xml.dist exclude pattern likely won’t match tests/phpstan/scan-files.php because it starts with a leading / (paths are typically relative to the ruleset basepath) and doesn’t include the .php suffix. Update the pattern to match the actual file path (e.g., use a wildcard prefix like */ and include/anchor the .php extension) so PHPCS reliably excludes this bootstrap file.

Suggested change
<exclude-pattern>/tests/phpstan/scan-files</exclude-pattern>
<exclude-pattern>*/tests/phpstan/scan-files\.php$</exclude-pattern>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regular expression for the exclude-pattern seems incorrect. With basepath set to ./, file paths are relative (e.g., tests/phpstan/scan-files.php). The leading slash in /tests/phpstan/scan-files will prevent it from matching this path.

To correctly exclude the new file, you should remove the leading slash and consider making the pattern more specific to avoid unintended matches, similar to other patterns in this file.

	<exclude-pattern>tests/phpstan/scan-files\.php$</exclude-pattern>

</ruleset>
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ parameters:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
- tests/phpstan/scan-files.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.parameter
- identifier: missingType.return
dynamicConstantNames:
- ABSPATH
3 changes: 0 additions & 3 deletions src/Capabilities_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ private static function get_role( $role ) {

/**
* Assert that the roles are persisted to the database.
*
* @throws \WP_CLI\ExitException If the roles are not persisted to the
* database.
*/
private static function persistence_check() {
global $wp_roles;
Expand Down
3 changes: 0 additions & 3 deletions src/Role_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,6 @@ public function reset( $args, $assoc_args ) {

/**
* Assert that the roles are persisted to the database.
*
* @throws \WP_CLI\ExitException If the roles are not persisted to the
* database.
*/
private static function persistence_check() {
global $wp_roles;
Expand Down
3 changes: 3 additions & 0 deletions tests/phpstan/scan-files.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

define( 'ABSPATH', '' );
Loading