@@ -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 | ) { |
@@ -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; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function get(string|int $index, $default = null): mixed |
|
| 21 | + public function get(string | int $index, $default = null): mixed |
|
| 22 | 22 | { |
| 23 | 23 | return $this->elements[$index] ?? $default; |
| 24 | 24 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | return true; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function indexOf(mixed $element): bool|int|string |
|
| 47 | + public function indexOf(mixed $element): bool | int | string |
|
| 48 | 48 | { |
| 49 | 49 | return array_search($element, $this->elements, true); |
| 50 | 50 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return $this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function forEach(callable $callback, bool $stopable = false): static |
|
| 100 | + public function forEach (callable $callback, bool $stopable = false): static |
|
| 101 | 101 | { |
| 102 | 102 | foreach ($this->elements as $index => $element) { |
| 103 | 103 | $result = call_user_func_array($callback, [$element, $index]); |