@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField |
|
| 51 | + public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField |
|
| 52 | 52 | { |
| 53 | 53 | $violations = $this->newEmptyValidationResult(); |
| 54 | 54 | foreach ($this->rules as $constraint) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return array |
| 90 | 90 | * @throws ReflectionException if the class does not exist |
| 91 | 91 | */ |
| 92 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): array |
|
| 92 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): array |
|
| 93 | 93 | { |
| 94 | 94 | $ruleSets = []; |
| 95 | 95 | foreach ((new ReflectionClass($objectOrClass))->getProperties($filter) as $property) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return static |
| 106 | 106 | * @throws ReflectionException if the class or property does not exist. |
| 107 | 107 | */ |
| 108 | - public static function fromProperty(string|object $objectOrClass, string $property): self |
|
| 108 | + public static function fromProperty(string | object $objectOrClass, string $property): self |
|
| 109 | 109 | { |
| 110 | 110 | return self::fromReflectionProperty(new ReflectionProperty($objectOrClass, $property)); |
| 111 | 111 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | return $this->ruleSets[] = ValidationSet::forField($field); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function field(string $field, Validation|ValidationSet ...$rules): self |
|
| 29 | + public function field(string $field, Validation | ValidationSet ...$rules): self |
|
| 30 | 30 | { |
| 31 | 31 | $ruleset = $this->ruleSet($field); |
| 32 | 32 | foreach ($rules as $rule) { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return static |
| 81 | 81 | * @throws ReflectionException if the class does not exist |
| 82 | 82 | */ |
| 83 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): self |
|
| 83 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): self |
|
| 84 | 84 | { |
| 85 | 85 | $instance = new self; |
| 86 | 86 | $instance->ruleSets = ValidationSet::fromProperties($objectOrClass, $filter); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | public function validate(mixed $input, array $context = []): Result |
| 30 | 30 | { |
| 31 | 31 | $result = $this->newEmptyValidationResult(); |
| 32 | - return $this->evaluate($input, $context) ? $result: $result->error($this->message); |
|
| 32 | + return $this->evaluate($input, $context) ? $result : $result->error($this->message); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function isValid($input, array $context = []): bool |
@@ -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 | } |