Skip to content
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

Tests: Use PHPStan 2.0 #55

Merged
merged 2 commits into from
Dec 6, 2024
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"codeception/util-universalframework": "^1.0",
"php-webdriver/webdriver": "^1.0",
"wp-coding-standards/wpcs": "^3.0.0",
"phpstan/phpstan": "^1.7",
"szepeviktor/phpstan-wordpress": "^1.0",
"wp-cli/wp-cli": "2.8.1",
"phpstan/phpstan": "^1.0 || ^2.0",
"szepeviktor/phpstan-wordpress": "^1.0 || ^2.0",
"wp-cli/wp-cli": "2.11",
"gumlet/php-image-resize": "^1.6"
},
"minimum-stability": "dev",
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ parameters:
scanDirectories:
- /home/runner/work/convertkit-membermouse/convertkit-membermouse/wordpress/wp-content/plugins

# Location of constants for PHPStan to scan, building symbols.
scanFiles:
- /home/runner/work/convertkit-membermouse/convertkit-membermouse/wordpress/wp-config.php

# Should not need to edit anything below here
# Rule Level: https://phpstan.org/user-guide/rule-levels
level: 5
21 changes: 9 additions & 12 deletions phpstan.neon.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PHPStan configuration for local static analysis.
# PHPStan configuration for GitHub Actions.

# Include PHPStan for WordPress configuration.
includes:
Expand All @@ -9,25 +9,22 @@ parameters:
# Paths to scan
# This should comprise of the base Plugin PHP file, plus directories that contain Plugin PHP files
paths:
- wp-convertkit.php
- convertkit-membermouse.php
- admin/
- includes/

# Files that include Plugin-specific PHP constants
bootstrapFiles:
- wp-convertkit.php
- convertkit-membermouse.php

# Location of WordPress Plugins for PHPStan to scan, building symbols.
scanDirectories:
- /Users/tim/Local Sites/convertkit-github/app/public/wp-content/plugins
- /home/runner/work/convertkit-membermouse/convertkit-membermouse/wordpress/wp-content/plugins

# Location of constants for PHPStan to scan, building symbols.
scanFiles:
- /home/runner/work/convertkit-membermouse/convertkit-membermouse/wordpress/wp-config.php

# Should not need to edit anything below here
# Rule Level: https://phpstan.org/user-guide/rule-levels
level: 5

# Ignore the following errors, as PHPStan and PHPStan for WordPress haven't registered symbols for them yet,
# so they're false positives.
ignoreErrors:
- '#Access to an undefined property WP_Theme::#'
- '#Constant WP_MEMORY_LIMIT not found.#'
- '#Function apply_filters invoked with#' # apply_filters() accepted a variable number of parameters, which PHPStan fails to detect
level: 5