mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 00:47:25 -06:00
Improve PHPStan config
This commit is contained in:
parent
c10f0db170
commit
133efff2cd
@ -114,7 +114,7 @@
|
|||||||
],
|
],
|
||||||
"cs": "phpcs -s",
|
"cs": "phpcs -s",
|
||||||
"cs:fix": "phpcbf",
|
"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": [
|
"test": [
|
||||||
"@parallel test:unit test:db",
|
"@parallel test:unit test:db",
|
||||||
"@parallel test:api test:cli"
|
"@parallel test:api test:cli"
|
||||||
|
@ -109,7 +109,7 @@ function normalizeLocale(string $locale): string
|
|||||||
* minimum quality
|
* minimum quality
|
||||||
*
|
*
|
||||||
* @param non-empty-string $acceptLanguage
|
* @param non-empty-string $acceptLanguage
|
||||||
* @param float<0, 1> $minQuality
|
* @param float $minQuality
|
||||||
* @return iterable<string>;
|
* @return iterable<string>;
|
||||||
*/
|
*/
|
||||||
function acceptLanguageToLocales(string $acceptLanguage, float $minQuality = 0): 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
|
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
|
function getOptionalIntFromInputFilter(InputFilter $inputFilter, string $fieldName): ?int
|
||||||
{
|
{
|
||||||
$value = $inputFilter->getValue($fieldName);
|
$value = $inputFilter->getValue($fieldName);
|
||||||
return $value !== null ? (int) $value : null;
|
return $value !== null ? (int) $value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param InputFilter<mixed> $inputFilter
|
||||||
|
*/
|
||||||
function getOptionalBoolFromInputFilter(InputFilter $inputFilter, string $fieldName): ?bool
|
function getOptionalBoolFromInputFilter(InputFilter $inputFilter, string $fieldName): ?bool
|
||||||
{
|
{
|
||||||
$value = $inputFilter->getValue($fieldName);
|
$value = $inputFilter->getValue($fieldName);
|
||||||
return $value !== null ? (bool) $value : null;
|
return $value !== null ? (bool) $value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param InputFilter<mixed> $inputFilter
|
||||||
|
*/
|
||||||
function getNonEmptyOptionalValueFromInputFilter(InputFilter $inputFilter, string $fieldName): mixed
|
function getNonEmptyOptionalValueFromInputFilter(InputFilter $inputFilter, string $fieldName): mixed
|
||||||
{
|
{
|
||||||
$value = $inputFilter->getValue($fieldName);
|
$value = $inputFilter->getValue($fieldName);
|
||||||
|
@ -4,6 +4,11 @@ includes:
|
|||||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||||
- vendor/phpstan/phpstan-phpunit/rules.neon
|
- vendor/phpstan/phpstan-phpunit/rules.neon
|
||||||
parameters:
|
parameters:
|
||||||
|
level: 8
|
||||||
|
paths:
|
||||||
|
- module
|
||||||
|
- config
|
||||||
|
- docker/config
|
||||||
symfony:
|
symfony:
|
||||||
console_application_loader: 'config/cli-app.php'
|
console_application_loader: 'config/cli-app.php'
|
||||||
doctrine:
|
doctrine:
|
||||||
|
Loading…
Reference in New Issue
Block a user