From 605433d38833be052bde424b8d07de2b11494e40 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:17:35 -0700 Subject: [PATCH 1/6] Update composer requirements --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e471895..f463b14 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,8 @@ "php": "^8.2" }, "require-dev": { - "phpstan/phpstan": "^0.12.32", - "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^11.0 || ^12.0 || ^13.0", "squizlabs/php_codesniffer": "^4.0" }, From 68e3e65e0ed59127fc2693d8a209501796f8431b Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:18:41 -0700 Subject: [PATCH 2/6] rework configs --- phpstan-baseline.neon | 27 --------------------------- phpstan.neon | 10 ---------- phpstan.neon.dist | 7 +++++++ 3 files changed, 7 insertions(+), 37 deletions(-) delete mode 100644 phpstan-baseline.neon delete mode 100644 phpstan.neon create mode 100644 phpstan.neon.dist diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index 353be27..0000000 --- a/phpstan-baseline.neon +++ /dev/null @@ -1,27 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Method Firehed\\\\Input\\\\Exceptions\\\\InputException\\:\\:__construct\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#" - count: 1 - path: src/Exceptions/InputException.php - - - - message: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:nestedValidationExceptions\\(\\) has no return typehint specified\\.$#" - count: 1 - path: tests/Containers/ParsedInputTest.php - - - - message: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:testValidateHandlesInputExceptions\\(\\) has parameter \\$invalid with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Containers/ParsedInputTest.php - - - - message: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:testValidateHandlesInputExceptions\\(\\) has parameter \\$missing with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Containers/ParsedInputTest.php - - - - message: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:testValidateHandlesInputExceptions\\(\\) has parameter \\$unexpected with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Containers/ParsedInputTest.php - diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 2a4ecd7..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,10 +0,0 @@ -includes: - - phpstan-baseline.neon - - vendor/phpstan/phpstan-phpunit/extension.neon -parameters: - excludes_analyse: - - vendor - level: max - paths: - - src - - tests diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..5d1e35d --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,7 @@ +# vim: ft=yaml +parameters: + level: max + paths: + - . + excludePaths: + - vendor From c99abcba0e2e0d1fa551fb428a79ecf0857cc5a6 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:38:53 -0700 Subject: [PATCH 3/6] rebaselien --- phpstan-baseline.neon | 157 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..95caf8b --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,157 @@ +parameters: + ignoreErrors: + - + message: '#^Binary operation "\." between non\-falsy\-string and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 2 + path: src/Containers/ParsedInput.php + + - + message: '#^Cannot access offset \(int\|string\) on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/Containers/ParsedInput.php + + - + message: '#^Cannot access offset string on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 2 + path: src/Containers/ParsedInput.php + + - + message: '#^Method Firehed\\Input\\Containers\\ParsedInput\:\:asArray\(\) should return array\ but returns mixed\.$#' + identifier: return.type + count: 1 + path: src/Containers/ParsedInput.php + + - + message: '#^Parameter \#1 \$array of function array_keys expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/ParsedInput.php + + - + message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/ParsedInput.php + + - + message: '#^Parameter \#2 \$array of function array_key_exists expects array, mixed given\.$#' + identifier: argument.type + count: 3 + path: src/Containers/ParsedInput.php + + - + message: '#^Parameter \#2 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/ParsedInput.php + + - + message: '#^Parameter \#1 \$data of class Firehed\\Input\\Containers\\ParsedInput constructor expects array\, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/RawInput.php + + - + message: '#^Parameter \#1 \$raw_input of method Firehed\\Input\\Interfaces\\ParserInterface\:\:parse\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/RawInput.php + + - + message: '#^Parameter \#1 \$data of method Firehed\\Input\\Containers\\ParsedInput\:\:__construct\(\) expects array\, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/Containers/SafeInput.php + + - + message: '#^Method Firehed\\Input\\Exceptions\\InputException\:\:__construct\(\) has parameter \$errors with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$invalid \(array\\) does not accept array\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$invalid \(array\\) does not accept mixed\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$missing \(array\\) does not accept array\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$missing \(array\\) does not accept mixed\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$unexpected \(array\\) does not accept array\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$unexpected \(array\\) does not accept mixed\.$#' + identifier: assign.propertyType + count: 1 + path: src/Exceptions/InputException.php + + - + message: '#^Call to function is_array\(\) with array\\|string\> will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: src/Parsers/URLEncoded.php + + - + message: '#^Trait Firehed\\Input\\SafeInputTestTrait is used zero times and is not analysed\.$#' + identifier: trait.unused + count: 1 + path: src/SafeInputTestTrait.php + + - + message: '#^Trait Firehed\\Input\\ValidationTestTrait is used zero times and is not analysed\.$#' + identifier: trait.unused + count: 1 + path: src/ValidationTestTrait.php + + - + message: '#^Method Firehed\\Input\\Containers\\ParsedInputTest\:\:nestedValidationExceptions\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Method Firehed\\Input\\Containers\\ParsedInputTest\:\:testValidateHandlesInputExceptions\(\) has parameter \$invalid with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Method Firehed\\Input\\Containers\\ParsedInputTest\:\:testValidateHandlesInputExceptions\(\) has parameter \$missing with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Method Firehed\\Input\\Containers\\ParsedInputTest\:\:testValidateHandlesInputExceptions\(\) has parameter \$unexpected with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Dead catch \- LogicException is never thrown in the try block\.$#' + identifier: catch.neverThrown + count: 1 + path: tests/Exceptions/InputExceptionTest.php From 2afaff9924f80f0e45589b2a9f6f1bdb3ca2e55b Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:41:25 -0700 Subject: [PATCH 4/6] PHPStan back to current in ci, expand phpunti matrix --- .github/workflows/static-analysis.yml | 1 - .github/workflows/test.yml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 179a2d9..83f3ea4 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -20,7 +20,6 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' - name: Cache Composer packages id: composer-cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1741a11..8111831 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,10 @@ jobs: - 'low' php: - '8.2' + - '8.3' + - '8.4' + - '8.5' + - '8.6-dev' steps: - name: Check out code From 83e735ca16db61dc98198237413dac1a236399ae Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:42:12 -0700 Subject: [PATCH 5/6] More phpstan baseline, fix config --- phpstan-baseline.neon | 48 +++++++++++++++++++++++++++++++++++++++++++ phpstan.neon.dist | 3 +++ 2 files changed, 51 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 95caf8b..581fb5a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -126,6 +126,24 @@ parameters: count: 1 path: src/ValidationTestTrait.php + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Firehed\\\\Input\\\\Containers\\\\SafeInput'' and Firehed\\Input\\Containers\\SafeInput will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 3 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Firehed\\\\Input…'' and Firehed\\Input\\Containers\\SafeInput will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 3 + path: tests/Containers/ParsedInputTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with arguments ''Firehed\\\\Input…'', Firehed\\Input\\Containers\\ParsedInput and ''Construct failed'' will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Containers/ParsedInputTest.php + - message: '#^Method Firehed\\Input\\Containers\\ParsedInputTest\:\:nestedValidationExceptions\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -150,8 +168,38 @@ parameters: count: 1 path: tests/Containers/ParsedInputTest.php + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with arguments ''Firehed\\\\Input…'', Firehed\\Input\\Containers\\ParsedInput and ''RawInput\:\:parse\(\)…'' will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Containers/RawInputTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with arguments ''Firehed\\\\Input…'', Firehed\\Input\\Containers\\RawInput and ''Construct failed'' will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Containers/RawInputTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Firehed\\\\Input\\\\Containers\\\\SafeInput'' and Firehed\\Input\\Containers\\SafeInput will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Containers/SafeInputTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with arguments ''Firehed\\\\Input\\\\Exceptions\\\\InputException'', Firehed\\Input\\Exceptions\\InputException and non\-falsy\-string will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Exceptions/InputExceptionTest.php + - message: '#^Dead catch \- LogicException is never thrown in the try block\.$#' identifier: catch.neverThrown count: 1 path: tests/Exceptions/InputExceptionTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Firehed\\\\Input\\\\Objects\\\\InputObject'' and Firehed\\Input\\Objects\\InputObject will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/Objects/InputObjectTest.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 5d1e35d..4d046ab 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,4 +1,7 @@ # vim: ft=yaml +includes: + - phpstan-baseline.neon + - vendor/phpstan/phpstan-phpunit/extension.neon parameters: level: max paths: From c1ee9cf2204777b5c2083dd4bc29b838e0d71fd8 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Sat, 9 May 2026 16:42:39 -0700 Subject: [PATCH 6/6] format --- .github/workflows/static-analysis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 83f3ea4..8294b8f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -19,7 +19,6 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 - with: - name: Cache Composer packages id: composer-cache