From 3a5e6fde39359aa65641a68cc9c8049de9203df1 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Mon, 3 Nov 2025 12:48:41 +0100 Subject: [PATCH] feat: upgrade phpstan 1 => 2 (generate baseline) feat: allow symfony 7 and 8 --- composer.json | 8 ++++---- phpstan-baseline.neon | 19 +++++++++++++++++++ phpstan.neon | 3 +++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 phpstan-baseline.neon diff --git a/composer.json b/composer.json index 9b082b3..45f4c24 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,10 @@ "php": ">=8.0" }, "require-dev": { - "phpstan/phpstan": "^1.4", - "phpunit/phpunit": "^9.5.0", - "symfony/phpunit-bridge": "^6.3", - "symfony/var-dumper": "^5.4|^6.0" + "phpstan/phpstan": "^2.1.31", + "phpunit/phpunit": "^9.6.29", + "symfony/phpunit-bridge": "^6.4|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0|^8.0" }, "config": { "preferred-install": "dist", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..231dfe1 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,19 @@ +parameters: + ignoreErrors: + - + message: '#^@readonly property Zenstruck\\Bytes\:\:\$system is assigned outside of the constructor\.$#' + identifier: property.readOnlyByPhpDocAssignNotInConstructor + count: 2 + path: src/Bytes.php + + - + message: '#^@readonly property Zenstruck\\Bytes\:\:\$units is assigned outside of the constructor\.$#' + identifier: property.readOnlyByPhpDocAssignNotInConstructor + count: 2 + path: src/Bytes.php + + - + message: '#^@readonly property cannot have a default value\.$#' + identifier: property.readOnlyByPhpDocDefaultValue + count: 2 + path: src/Bytes.php diff --git a/phpstan.neon b/phpstan.neon index f6c9ddc..b6d062c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ +includes: + - phpstan-baseline.neon + parameters: level: 8 treatPhpDocTypesAsCertain: false