diff --git a/RoboFile.php b/RoboFile.php index 3d252e0fd4..a2ad1421bd 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -475,7 +475,6 @@ class RoboFile extends \Robo\Tasks { 'WP_ROOT="' . getenv('WP_ROOT') . '"', 'php -d memory_limit=2G', "$dir/tasks/phpstan/vendor/bin/phpstan analyse ", - '--level 7', ]); // PHPStan must be run out of main plugin directory to avoid its autoloading diff --git a/tasks/phpstan/phpstan-tests.neon b/tasks/phpstan/phpstan-tests.neon index 533ef4d646..e923f800be 100644 --- a/tasks/phpstan/phpstan-tests.neon +++ b/tasks/phpstan/phpstan-tests.neon @@ -1,4 +1,5 @@ parameters: + level: 8 tmpDir: ../../temp/phpstan bootstrap: bootstrap.php autoload_files: @@ -15,9 +16,16 @@ parameters: - WP_DEBUG ignoreErrors: - '/Parameter #1 $cssOrXPath of method AcceptanceTester::moveMouseOver() expects string|null, array given./' + - '/(with|has) no (return )?typehint specified/' # exclude level 6 errors excludes_analyse: - ../../tests/_support/_generated + # exclude level 6 errors + checkGenericClassInNonGenericObjectType: false + checkMissingIterableValueType: false + checkMissingVarTagTypehint: false + checkMissingTypehints: false + includes: - vendor/phpstan/phpstan-phpunit/extension.neon - extensions/PHPUnit5CompatExtension/extension.neon diff --git a/tasks/phpstan/phpstan.neon b/tasks/phpstan/phpstan.neon index df904bbfec..0b38603fd7 100644 --- a/tasks/phpstan/phpstan.neon +++ b/tasks/phpstan/phpstan.neon @@ -1,4 +1,5 @@ parameters: + level: 8 tmpDir: ../../temp/phpstan bootstrap: bootstrap.php inferPrivatePropertyTypeFromConstructor: true @@ -13,9 +14,16 @@ parameters: - '#Parameter \#2 \$prefix of function http_build_query expects string, null given.#' - '#Parameter \#1 \$function of function call_user_func_array expects callable(): mixed, .wc_.*. given.#' - '#Parameter \#1 \$reader of class MailPoetVendor\\Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver constructor expects MailPoetVendor\\Doctrine\\Common\\Annotations\\AnnotationReader, MailPoetVendor\\Doctrine\\Common\\Annotations\\CachedReader given#' + - '/(with|has) no (return )?typehint specified/' # exclude level 6 errors reportUnmatchedIgnoredErrors: false dynamicConstantNames: - WP_DEBUG - MAILPOET_PREMIUM_INITIALIZED + + # exclude level 6 errors + checkGenericClassInNonGenericObjectType: false + checkMissingIterableValueType: false + checkMissingVarTagTypehint: false + checkMissingTypehints: false includes: - phpstan-baseline.neon # https://medium.com/@ondrejmirtes/phpstans-baseline-feature-lets-you-hold-new-code-to-a-higher-standard-e77d815a5dff