mirror of
https://github.com/Respect/Validation.git
synced 2024-06-07 08:12:16 +02:00
Increate PHPStan level to 6
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
103a47e134
commit
4519739f8b
|
@ -178,10 +178,11 @@ class NestedValidationException extends ValidationException implements IteratorA
|
|||
}
|
||||
|
||||
$exceptions = $this->getIterator();
|
||||
/** @var ValidationException $exception */
|
||||
foreach ($exceptions as $exception) {
|
||||
$messages[] = sprintf(
|
||||
'%s- %s',
|
||||
str_repeat(' ', ($exceptions[$exception] - $leveler) * 2),
|
||||
str_repeat(' ', (int) ($exceptions[$exception] - $leveler) * 2),
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ final class Length extends AbstractRule
|
|||
private function extractLength($input): ?int
|
||||
{
|
||||
if (is_string($input)) {
|
||||
return mb_strlen($input, mb_detect_encoding($input));
|
||||
return (int) mb_strlen($input, mb_detect_encoding($input));
|
||||
}
|
||||
|
||||
if (is_array($input) || $input instanceof CountableInterface) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class Size extends AbstractRule
|
|||
public $minSize;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var float
|
||||
*/
|
||||
public $minValue;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Size extends AbstractRule
|
|||
public $maxSize;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
* @var float
|
||||
*/
|
||||
public $maxValue;
|
||||
|
||||
|
@ -60,9 +60,9 @@ class Size extends AbstractRule
|
|||
*
|
||||
* @param mixed $size
|
||||
*
|
||||
* @return int
|
||||
* @return float
|
||||
*/
|
||||
private function toBytes($size)
|
||||
private function toBytes($size): float
|
||||
{
|
||||
$value = $size;
|
||||
$units = ['b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb'];
|
||||
|
@ -75,18 +75,18 @@ class Size extends AbstractRule
|
|||
}
|
||||
|
||||
if (!is_numeric($value)) {
|
||||
throw new ComponentException(sprintf('"%s" is not a recognized file size.', $size));
|
||||
throw new ComponentException(sprintf('"%s" is not a recognized file size.', (string) $size));
|
||||
}
|
||||
|
||||
return $value;
|
||||
return (float) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $size
|
||||
* @param float $size
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isValidSize($size)
|
||||
private function isValidSize(float $size): bool
|
||||
{
|
||||
if (null !== $this->minValue && null !== $this->maxValue) {
|
||||
return $size >= $this->minValue && $size <= $this->maxValue;
|
||||
|
@ -109,7 +109,7 @@ class Size extends AbstractRule
|
|||
}
|
||||
|
||||
if (is_string($input)) {
|
||||
return $this->isValidSize(filesize($input));
|
||||
return $this->isValidSize((int) filesize($input));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -8,7 +8,7 @@ parameters:
|
|||
ignoreErrors:
|
||||
- '/Call to an undefined static method Respect\\Validation\\Validator::iDoNotExistSoIShouldThrowException/'
|
||||
- '/Parameter #2 $locale of function setlocale expects array|string|null, int given./'
|
||||
level: 5
|
||||
level: 6
|
||||
paths:
|
||||
- library/
|
||||
- tests/
|
||||
|
|
Loading…
Reference in a new issue