From a14234cb4c5f6a0542dc9bc5006a8b15f13df447 Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Thu, 28 Nov 2024 13:45:57 +0100 Subject: [PATCH] upgraded PHPStan from 1.12 to 2.0 --- .github/workflows/{phpstan.yml => static-analysis.yml} | 6 ++++-- composer.json | 4 ++-- phpstan.neon | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) rename .github/workflows/{phpstan.yml => static-analysis.yml} (77%) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/static-analysis.yml similarity index 77% rename from .github/workflows/phpstan.yml rename to .github/workflows/static-analysis.yml index e5d3006..8dc4c41 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/static-analysis.yml @@ -5,19 +5,21 @@ on: branches: - "*.x" paths: - - ".github/workflows/phpstan.yml" + - ".github/workflows/static-analysis.yml" - "composer.*" - "src/**" - "phpstan*" + - "psalm*" - "tests/**" push: branches: - "*.x" paths: - - ".github/workflows/phpstan.yml" + - ".github/workflows/static-analysis.yml" - "composer.*" - "src/**" - "phpstan*" + - "psalm*" - "tests/**" jobs: diff --git a/composer.json b/composer.json index 4babea2..1ee674e 100644 --- a/composer.json +++ b/composer.json @@ -24,9 +24,9 @@ "require-dev": { "doctrine/coding-standard": "^12.0.0", "phpdocumentor/guides-cli": "^1.5.0", - "phpstan/phpstan": "^1.12.11", + "phpstan/phpstan": "^2.0.2", "phpunit/phpunit": "^10.5.38", - "vimeo/psalm": "^5.15.0" + "vimeo/psalm": "^5.26.1" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index 299c868..a84925a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,14 @@ parameters: level: 6 - checkGenericClassInNonGenericObjectType: false + treatPhpDocTypesAsCertain: false paths: - src - tests ignoreErrors: + - + identifier: missingType.generics + - + identifier: method.alreadyNarrowedType - message: '#expects .*Collection<\(int\|string\), object>, .*ArrayCollection given#' path: tests/DoctrineObjectTest.php