@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function validateOrFail($input, array $context = [], string $message = 'Validation errors'): void |
9 | 9 | { |
10 | - if (! $this instanceof Validation) { |
|
10 | + if (!$this instanceof Validation) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 |
@@ -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 | ) { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | public function validateNumbersWithCorrectLength(string $unmaskedInput): bool |
52 | 52 | { |
53 | - $numericWithSize = '/^\d{' . $this->unmaskedLength() . '}$/'; |
|
53 | + $numericWithSize = '/^\d{'.$this->unmaskedLength().'}$/'; |
|
54 | 54 | return preg_match($numericWithSize, $unmaskedInput) === 1; |
55 | 55 | } |
56 | 56 |