From 499dbc7551287e90726934521fb35908a68c4afb Mon Sep 17 00:00:00 2001 From: Chris Portscheller Date: Mon, 17 Aug 2026 22:17:26 -0500 Subject: [PATCH] chore(stan): WP-CLI stubs so the CLI command analyzes clean phpstan cannot see WP-CLI's symbols (they exist only under the CLI), so class-webdecoy-cli.php produced 20 unknown-class findings. A minimal hand-written stub (no composer binary available in this environment) declares exactly the symbols the command uses. --- phpstan.neon | 1 + tests/stubs/wp-cli-stubs.php | 56 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/stubs/wp-cli-stubs.php diff --git a/phpstan.neon b/phpstan.neon index d5a71e6..e83d1d5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,5 +12,6 @@ parameters: bootstrapFiles: - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php - vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php + - tests/stubs/wp-cli-stubs.php ignoreErrors: - '#Constant [A-Z_]+ not found#' diff --git a/tests/stubs/wp-cli-stubs.php b/tests/stubs/wp-cli-stubs.php new file mode 100644 index 0000000..b87c55b --- /dev/null +++ b/tests/stubs/wp-cli-stubs.php @@ -0,0 +1,56 @@ + $assoc_args + */ + public static function confirm(string $question, array $assoc_args = []): void + { + } + } +} + +namespace WP_CLI\Utils { + /** + * @param array> $items + * @param array $fields + */ + function format_items(string $format, array $items, array $fields): void + { + } +}