WordPress-Coding-Standards/phpstan.neon.dist
jrfnl bb305f8768
Tests: allow for PHPUnit 8/9
PHP_CodeSniffer 3.8.0 now allows for running the tests, which are based on the PHPCS native test suite, with PHPUnit 8 and 9.

This commit updates the package to take advantage of that.

Includes:
* Widening the PHPUnit version requirements.
* Adding the PHPUnit 8+ cache file to `.gitignore`.
* Updating the PHPUnit configuration to make sure that deprecations will always show, even when on a high PHPUnit 9.6 version.
* Updating the info in `CONTRIBUTING`.
* Simplifications to the `quicktest` and `test` workflows.
    Also, the code coverage "high" run can now be run against PHP 8.3.
* Running PHPStan against PHP `latest` (couldn't previously be done due to the old PHPUnit version).
* Minor tweak to the PHPStan config to make sure PHP 8.x specific issues don't get flagged for this codebase.
* Removing a no longer needed `--ignore-platform*` argument.
* Updating the "setUp" method in one test to call the parent "setUp" method via the new method name.

Ref:
* PHPCSStandards/PHP_CodeSniffer 59
2023-12-11 14:15:45 +01:00

38 lines
1.4 KiB
Text

parameters:
phpVersion: 70100 # Needs to be 70100 or higher... sigh...
level: 5
paths:
- WordPress
bootstrapFiles:
- Tests/bootstrap.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
# Level 0
- '#^Result of method \S+ \(void\) is used\.$#'
-
# False positive. Will be fixed via next version of PHPCSUtils.
count: 1
message: "#^Cannot unset offset 'query' on non-empty-array<int, array<string, int\\|string>>.$#"
path: WordPress/Sniffs/DB/PreparedSQLPlaceholdersSniff.php
# Level 4
- '#^Property \S+::\$\S+ \([^)]+\) in isset\(\) is not nullable\.$#'
-
count: 1
message: '#^Result of && is always true\.$#'
path: WordPress/Sniffs/Security/EscapeOutputSniff.php
-
count: 1
message: '#^Strict comparison using === between true and false will always evaluate to false\.$#'
path: WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php
-
# False positive. Will be fixed via next version of PHPCSUtils.
count: 1
message: "#^Cannot unset offset 'file' on array<int, array<string, int\\|string>>.$#"
path: WordPress/Sniffs/Security/EscapeOutputSniff.php
# Level 5
- '#^Parameter \#3 \$value of method \S+File::recordMetric\(\) expects string, \(?(float|int|bool)(\|(float|int|bool))*\)? given\.$#'