diff --git a/composer.json b/composer.json index f695b063..cd0addb2 100644 --- a/composer.json +++ b/composer.json @@ -114,7 +114,7 @@ ], "cs": "phpcs -s", "cs:fix": "phpcbf", - "stan": "APP_ENV=test php vendor/bin/phpstan analyse module/*/src module/*/test* module/*/config module/*/migrations config docker/config --level=8", + "stan": "APP_ENV=test php vendor/bin/phpstan analyse", "test": [ "@parallel test:unit test:db", "@parallel test:api test:cli" diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 720f27c1..160ba35e 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -109,7 +109,7 @@ function normalizeLocale(string $locale): string * minimum quality * * @param non-empty-string $acceptLanguage - * @param float<0, 1> $minQuality + * @param float $minQuality * @return iterable; */ function acceptLanguageToLocales(string $acceptLanguage, float $minQuality = 0): iterable @@ -142,21 +142,31 @@ function acceptLanguageToLocales(string $acceptLanguage, float $minQuality = 0): */ function splitLocale(string $locale): array { - return array_pad(explode('-', $locale), length: 2, value: null); + [$lang, $countryCode] = array_pad(explode('-', $locale), length: 2, value: null); + return [$lang, $countryCode]; } +/** + * @param InputFilter $inputFilter + */ function getOptionalIntFromInputFilter(InputFilter $inputFilter, string $fieldName): ?int { $value = $inputFilter->getValue($fieldName); return $value !== null ? (int) $value : null; } +/** + * @param InputFilter $inputFilter + */ function getOptionalBoolFromInputFilter(InputFilter $inputFilter, string $fieldName): ?bool { $value = $inputFilter->getValue($fieldName); return $value !== null ? (bool) $value : null; } +/** + * @param InputFilter $inputFilter + */ function getNonEmptyOptionalValueFromInputFilter(InputFilter $inputFilter, string $fieldName): mixed { $value = $inputFilter->getValue($fieldName); diff --git a/phpstan.neon b/phpstan.neon index 7e21a038..72c5ea6d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,6 +4,11 @@ includes: - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon parameters: + level: 8 + paths: + - module + - config + - docker/config symfony: console_application_loader: 'config/cli-app.php' doctrine: