mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Resolved all phpstan errors
This commit is contained in:
parent
934d266880
commit
de5666d262
@ -113,7 +113,7 @@
|
|||||||
],
|
],
|
||||||
"cs": "phpcs",
|
"cs": "phpcs",
|
||||||
"cs:fix": "phpcbf",
|
"cs:fix": "phpcbf",
|
||||||
"stan": "phpstan analyse module/*/src/ module/*/config config docker/config data/migrations --level=7",
|
"stan": "phpstan analyse module/*/src module/*/config config docker/config data/migrations --level=7",
|
||||||
"test": [
|
"test": [
|
||||||
"@test:unit",
|
"@test:unit",
|
||||||
"@test:db",
|
"@test:db",
|
||||||
|
@ -12,40 +12,36 @@ use function Shlinkio\Shlink\Core\kebabCaseToCamelCase;
|
|||||||
use function sprintf;
|
use function sprintf;
|
||||||
use function str_contains;
|
use function str_contains;
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
abstract class BaseCommand extends Command
|
abstract class BaseCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param mixed|null $default
|
* @param string|string[]|bool|null $default
|
||||||
*/
|
*/
|
||||||
protected function addOptionWithDeprecatedFallback(
|
protected function addOptionWithDeprecatedFallback(
|
||||||
string $name,
|
string $name,
|
||||||
?string $shortcut = null,
|
?string $shortcut = null,
|
||||||
?int $mode = null,
|
?int $mode = null,
|
||||||
string $description = '',
|
string $description = '',
|
||||||
$default = null,
|
bool|string|array|null $default = null,
|
||||||
): self {
|
): self {
|
||||||
$this->addOption($name, $shortcut, $mode, $description, $default);
|
$this->addOption($name, $shortcut, $mode, $description, $default);
|
||||||
|
|
||||||
if (str_contains($name, '-')) {
|
if (str_contains($name, '-')) {
|
||||||
$camelCaseName = kebabCaseToCamelCase($name);
|
$camelCaseName = kebabCaseToCamelCase($name);
|
||||||
$this->addOption($camelCaseName, null, $mode, sprintf('[DEPRECATED] Same as "%s".', $name), $default);
|
$this->addOption($camelCaseName, null, $mode, sprintf('[DEPRECATED] Alias for "%s".', $name), $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// @phpstan-ignore-next-line
|
||||||
* @return bool|string|string[]|null
|
protected function getOptionWithDeprecatedFallback(InputInterface $input, string $name) // phpcs:ignore
|
||||||
*/
|
|
||||||
protected function getOptionWithDeprecatedFallback(InputInterface $input, string $name)
|
|
||||||
{
|
{
|
||||||
$rawInput = method_exists($input, '__toString') ? $input->__toString() : '';
|
$rawInput = method_exists($input, '__toString') ? $input->__toString() : '';
|
||||||
$camelCaseName = kebabCaseToCamelCase($name);
|
$camelCaseName = kebabCaseToCamelCase($name);
|
||||||
|
$resolvedOptionName = str_contains($rawInput, $camelCaseName) ? $camelCaseName : $name;
|
||||||
|
|
||||||
if (str_contains($rawInput, $camelCaseName)) {
|
return $input->getOption($resolvedOptionName);
|
||||||
return $input->getOption($camelCaseName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $input->getOption($name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,7 @@ class GeolocationDbUpdateFailedException extends RuntimeException implements Exc
|
|||||||
return $e;
|
return $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static function withInvalidEpochInOldDb(mixed $buildEpoch): self
|
||||||
* @param mixed $buildEpoch
|
|
||||||
*/
|
|
||||||
public static function withInvalidEpochInOldDb($buildEpoch): self
|
|
||||||
{
|
{
|
||||||
$e = new self(sprintf(
|
$e = new self(sprintf(
|
||||||
'Build epoch with value "%s" from existing geolocation database, could not be parsed to integer.',
|
'Build epoch with value "%s" from existing geolocation database, could not be parsed to integer.',
|
||||||
|
Loading…
Reference in New Issue
Block a user