@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | class ValidationException extends Exception |
10 | 10 | { |
11 | - private ValidationResultSet|ValidationResult $violations; |
|
11 | + private ValidationResultSet | ValidationResult $violations; |
|
12 | 12 | |
13 | 13 | public function __construct( |
14 | - ValidationResultSet|ValidationResult $violations, |
|
14 | + ValidationResultSet | ValidationResult $violations, |
|
15 | 15 | ?string $message = null, |
16 | 16 | $code = 422, |
17 | 17 | Throwable $previous = null |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | return |
29 | 29 | $this->violations instanceof ValidationResultSet ? |
30 | - $this->violations->validationResults() : |
|
31 | - [$this->violations]; |
|
30 | + $this->violations->validationResults() : [$this->violations]; |
|
32 | 31 | } |
33 | 32 | |
34 | 33 | private function formatMessage(): string |
@@ -41,6 +40,6 @@ discard block |
||
41 | 40 | } |
42 | 41 | } |
43 | 42 | |
44 | - return "Validation errors:" . PHP_EOL . implode(PHP_EOL, $messages); |
|
43 | + return "Validation errors:".PHP_EOL.implode(PHP_EOL, $messages); |
|
45 | 44 | } |
46 | 45 | } |
@@ -26,8 +26,7 @@ |
||
26 | 26 | try { |
27 | 27 | $datetime = |
28 | 28 | $input instanceof DateTimeInterface ? |
29 | - $input : |
|
30 | - new DateTimeImmutable($input); |
|
29 | + $input : new DateTimeImmutable($input); |
|
31 | 30 | |
32 | 31 | return $datetime > $this->datetime(); |
33 | 32 | } catch (Throwable) { |
@@ -26,8 +26,7 @@ |
||
26 | 26 | try { |
27 | 27 | $datetime = |
28 | 28 | $input instanceof DateTimeInterface ? |
29 | - $input : |
|
30 | - new DateTimeImmutable($input); |
|
29 | + $input : new DateTimeImmutable($input); |
|
31 | 30 | |
32 | 31 | return $datetime < $this->datetime(); |
33 | 32 | } catch (Throwable) { |
@@ -29,11 +29,10 @@ |
||
29 | 29 | return $this->field !== null; |
30 | 30 | } |
31 | 31 | |
32 | - private function newEmptyValidationResult(): ValidationResult|ValidationResultByField |
|
32 | + private function newEmptyValidationResult(): ValidationResult | ValidationResultByField |
|
33 | 33 | { |
34 | 34 | return |
35 | 35 | $this->belongsToField() ? |
36 | - new ValidationResultByField($this->getField()) : |
|
37 | - ValidationResult::everythingIsOk(); |
|
36 | + new ValidationResultByField($this->getField()) : ValidationResult::everythingIsOk(); |
|
38 | 37 | } |
39 | 38 | } |
@@ -21,8 +21,7 @@ |
||
21 | 21 | try { |
22 | 22 | $datetime = |
23 | 23 | $input instanceof DateTimeInterface ? |
24 | - $input : |
|
25 | - new DateTimeImmutable($input); |
|
24 | + $input : new DateTimeImmutable($input); |
|
26 | 25 | |
27 | 26 | return array_key_exists($this->other, $context) |
28 | 27 | && $datetime > (new DateTimeImmutable($context[$this->other])); |
@@ -21,8 +21,7 @@ |
||
21 | 21 | try { |
22 | 22 | $datetime = |
23 | 23 | $input instanceof DateTimeInterface ? |
24 | - $input : |
|
25 | - new DateTimeImmutable($input); |
|
24 | + $input : new DateTimeImmutable($input); |
|
26 | 25 | |
27 | 26 | return array_key_exists($this->other, $context) |
28 | 27 | && $datetime < (new DateTimeImmutable($context[$this->other])); |
@@ -12,8 +12,8 @@ |
||
12 | 12 | const MESSAGE = 'The value should be between `%s` and `%s` (%sincluding the boundaries)'; |
13 | 13 | |
14 | 14 | public function __construct( |
15 | - private int|float $min, |
|
16 | - private int|float $max, |
|
15 | + private int | float $min, |
|
16 | + private int | float $max, |
|
17 | 17 | private $boundaries = true, |
18 | 18 | ?string $message = null |
19 | 19 | ) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $number = substr($stringInput, 0, -1); |
33 | 33 | $digit = (int) substr($stringInput, -1); |
34 | 34 | return |
35 | - $digit === match ($this->algorithm) { |
|
35 | + $digit === match($this->algorithm) { |
|
36 | 36 | self::MOD11 => self::mod11($number), |
37 | 37 | self::MOD10 => self::mod10($number), |
38 | 38 | default => throw new InvalidArgumentException('Algoritmo de cálculo de dígito inválido') |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $sum += $number * $factor[$i++ % $size]; |
50 | 50 | } |
51 | 51 | |
52 | - return 11 - (($sum * 10 ) % 11); |
|
52 | + return 11 - (($sum * 10) % 11); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public static function mod10($input): int |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | $digits = substr($document, -2); |
74 | 74 | |
75 | 75 | $digit1 = DigitoVerificador::mod11($number); |
76 | - $digit2 = DigitoVerificador::mod11($number . $digit1); |
|
76 | + $digit2 = DigitoVerificador::mod11($number.$digit1); |
|
77 | 77 | |
78 | - return $digits === ($digit1 . $digit2); |
|
78 | + return $digits === ($digit1.$digit2); |
|
79 | 79 | } |
80 | 80 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | - public function set(string|int $index, mixed $value): self |
|
17 | + public function set(string | int $index, mixed $value): self |
|
18 | 18 | { |
19 | 19 | $this->insert($value, $index); |
20 | 20 | return $this; |