From e6dd169a1b8d81a313a0f57147ef4c1e4146ca65 Mon Sep 17 00:00:00 2001 From: Tom Udding Date: Sun, 20 Oct 2024 22:55:21 +0200 Subject: [PATCH] chore: update PHPStan config --- .idea/php.xml | 11 ++++++++++- .idea/phpspec.xml | 10 ++++++++++ phpstan.neon | 2 -- phpstan/phpstan-baseline.neon | 14 +++++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 .idea/phpspec.xml diff --git a/.idea/php.xml b/.idea/php.xml index 9be3064f7c..3eb233b7cf 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -136,7 +136,6 @@ - @@ -252,6 +251,16 @@ + + + + + + + + + + diff --git a/.idea/phpspec.xml b/.idea/phpspec.xml new file mode 100644 index 0000000000..33107fdc54 --- /dev/null +++ b/.idea/phpspec.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon index 4ea62cae94..373741d748 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,8 +5,6 @@ includes: parameters: level: 6 treatPhpDocTypesAsCertain: true - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false reportUnmatchedIgnoredErrors: false bootstrapFiles: - bootstrap.php diff --git a/phpstan/phpstan-baseline.neon b/phpstan/phpstan-baseline.neon index ab94f67291..330b477967 100644 --- a/phpstan/phpstan-baseline.neon +++ b/phpstan/phpstan-baseline.neon @@ -1,5 +1,9 @@ parameters: ignoreErrors: + - identifier: + missingType.iterableValue + - identifier: + missingType.generics - '#Call to an undefined method Laminas\\Stdlib\\RequestInterface::[a-zA-Z0-9_]+\(\)\.#' - '#Call to an undefined method Laminas\\Stdlib\\ResponseInterface::[a-zA-Z0-9_]+\(\)\.#' - "#Strict comparison using \\=\\=\\= between 'development' and 'production' will always evaluate to false\\.$#" @@ -23,17 +27,21 @@ parameters: - '#Property User\\Model\\ApiApp\:\:\$claims type mapping mismatch\: backing type string of enum User\\Model\\Enums\\JWTClaims does not match database type array\.$#' - '#Property User\\Model\\ApiApp\:\:\$claims type mapping mismatch\: database can contain User\\Model\\Enums\\JWTClaims\|null but property expects array\.$#' - '#Property User\\Model\\ApiApp\:\:\$claims type mapping mismatch\: property can contain array\ but database expects User\\Model\\Enums\\JWTClaims\|null.$#' + - '#Property User\\Model\\ApiApp\:\:\$claims type mapping mismatch\: database can contain array\\|null but property expects array\.$#' - message: '#Unreachable statement \- code above always terminates.$#' - path: ..//module/*/test/* + path: ../module/*/test/* - message: '#If condition is always true.$#' - path: ..//module/*/test/* + path: ../module/*/test/* - '#^Parameter \#1 \$valueMap of method PHPUnit\\Framework\\MockObject\\Builder\\InvocationMocker\\:\:willReturnMap\(\) expects array\\>, array\\|[a-zA-Z0-9\\_]+\> given.$#' - '#Return type \(array\) of method [a-zA-Z0-9_]+\\Form\\[a-zA-Z0-9_]+\:\:getInputFilterSpecification\(\) should be compatible with return type \(\*NEVER\*\) of method Laminas\\InputFilter\\InputFilterProviderInterface\:\:getInputFilterSpecification\(\)$#' - '#Return type \(array\) of method [a-zA-Z0-9_]+\\Form\\Fieldset\\[a-zA-Z0-9_]+\:\:getInputFilterSpecification\(\) should be compatible with return type \(\*NEVER\*\) of method Laminas\\InputFilter\\InputFilterProviderInterface\:\:getInputFilterSpecification\(\)$#' - '#^Conditional return type uses subject type TAdapter of User\\Authentication\\Adapter\\CompanyUserAdapter\|User\\Authentication\\Adapter\\UserAdapter which is not part of PHPDoc \@template tags.$#' - - '#Method User\\Mapper\\ApiAppAuthentication\:\:getFirstAndLastAuthenticationPerApiApp\(\) should return array\ but returns array\.$#' + - '#Method User\\Mapper\\ApiAppAuthentication\:\:getFirstAndLastAuthenticationPerApiApp\(\) should return array\ but returns array\.$#' - '#Static method ApplicationTest\\BaseControllerTest\:\:initServiceManager\(\) is unused.$#' - '#Method ApplicationTest\\BaseControllerTest\:\:bootstrapApplication\(\) is unused.$#' - '#Parameter \#1 \$data \(array\{contractNumber\: string\|null, startDate\: string, expirationDate\: string, published\: bool, article\: string\|null, articleEn\: string\|null\}\) of method Company\\Model\\CompanyFeaturedPackage\:\:exchangeArray\(\) should be compatible with parameter \$data \(array\{contractNumber\: string\|null, startDate\?\: string, expirationDate\?\: string, published\?\: bool\|string\}\) of method Company\\Model\\CompanyPackage\:\:exchangeArray\(\)$#' + - + message: '#^Parameter \#1 \$variables of class Laminas\\View\\Model\\JsonModel constructor expects array\\|ArrayAccess\\|Traversable\\|null, array\, array\{id\: int, name\: string\|null, nameEn\: string\|null, beginTime\: DateTime, endTime\: DateTime, location\: string\|null, locationEn\: string\|null, costs\: string\|null, \.\.\.\}\> given\.$#' + path: ../module/Activity/src/Controller/ApiController.php