Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Cache Composer packages
id: composer-cache
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
- 'low'
php:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
- '8.6-dev'

steps:
- name: Check out code
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
188 changes: 183 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,27 +1,205 @@
parameters:
ignoreErrors:
-
message: "#^Method Firehed\\\\Input\\\\Exceptions\\\\InputException\\:\\:__construct\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#"
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\<mixed\> 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\>, 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\>, 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\<string\>\) does not accept array\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$invalid \(array\<string\>\) does not accept mixed\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$missing \(array\<string\>\) does not accept array\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$missing \(array\<string\>\) does not accept mixed\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$unexpected \(array\<string\>\) does not accept array\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: '#^Property Firehed\\Input\\Exceptions\\InputException\:\:\$unexpected \(array\<string\>\) does not accept mixed\.$#'
identifier: assign.propertyType
count: 1
path: src/Exceptions/InputException.php

-
message: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:nestedValidationExceptions\\(\\) has no return typehint specified\\.$#"
message: '#^Call to function is_array\(\) with array\<int\|string, array\<mixed\>\|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: '#^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: "#^Method Firehed\\\\Input\\\\Containers\\\\ParsedInputTest\\:\\:testValidateHandlesInputExceptions\\(\\) has parameter \\$invalid with no value type specified in iterable type array\\.$#"
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\\:\\:testValidateHandlesInputExceptions\\(\\) has parameter \\$missing with no value type specified in iterable type array\\.$#"
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 \\$unexpected with no value type specified in iterable type array\\.$#"
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: '#^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
8 changes: 4 additions & 4 deletions phpstan.neon → phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# vim: ft=yaml
includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
excludes_analyse:
- vendor
level: max
paths:
- src
- tests
- .
excludePaths:
- vendor
Loading