Skip to content

Commit d11decc

Browse files
swissspidyclaude
andauthored
Add WP-Compat PHPStan extension configuration (#360)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 515843e commit d11decc

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎composer.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"php": ">=7.2.24",
1313
"behat/behat": "^v3.15.0",
1414
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || ^0.5 || ^0.6.2 || ^0.7.1 || ^1.0.0",
15+
"johnbillion/wp-compat": "^2.0",
1516
"php-parallel-lint/php-console-highlighter": "^1.0",
1617
"php-parallel-lint/php-parallel-lint": "^1.3.1",
1718
"phpcompatibility/php-compatibility": "^10.0",

‎extension.neon‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ rules:
2929
parameters:
3030
dynamicConstantNames:
3131
- FOO
32+
WPCompat:
33+
pluginFile: null
34+
# Oldest WordPress version supported by WP-CLI.
35+
requiresAtLeast: '4.9'
3236
strictRules:
3337
allRules: false
3438
disallowedLooseComparison: false
@@ -53,9 +57,13 @@ parameters:
5357
dynamicCallOnStaticMethod: false
5458
illegalConstructorMethodCall: false
5559

56-
# Add the schema from phpstan-strict-rules so it's available without loading the extension
57-
# and the above configuration works.
60+
# Add the schemas from phpstan-strict-rules and wp-compat so they're available without
61+
# loading the extensions and the above configuration works.
5862
parametersSchema:
63+
WPCompat: structure([
64+
pluginFile: schema(string(), nullable())
65+
requiresAtLeast: schema(string(), nullable())
66+
])
5967
strictRules: structure([
6068
allRules: anyOf(bool(), arrayOf(bool())),
6169
disallowedLooseComparison: anyOf(bool(), arrayOf(bool())),

0 commit comments

Comments
 (0)