mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-21 08:34:31 -06:00
Improve PHPStan config
This commit is contained in:
parent
c10f0db170
commit
133efff2cd
@ -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"
|
||||
|
@ -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<string>;
|
||||
*/
|
||||
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<mixed> $inputFilter
|
||||
*/
|
||||
function getOptionalIntFromInputFilter(InputFilter $inputFilter, string $fieldName): ?int
|
||||
{
|
||||
$value = $inputFilter->getValue($fieldName);
|
||||
return $value !== null ? (int) $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputFilter<mixed> $inputFilter
|
||||
*/
|
||||
function getOptionalBoolFromInputFilter(InputFilter $inputFilter, string $fieldName): ?bool
|
||||
{
|
||||
$value = $inputFilter->getValue($fieldName);
|
||||
return $value !== null ? (bool) $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputFilter<mixed> $inputFilter
|
||||
*/
|
||||
function getNonEmptyOptionalValueFromInputFilter(InputFilter $inputFilter, string $fieldName): mixed
|
||||
{
|
||||
$value = $inputFilter->getValue($fieldName);
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user