@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @throws ValidationException if the field is provided and is blank |
24 | 24 | */ |
25 | - final public function __construct(?string $field = null, Rule|RuleSet ...$rules) |
|
25 | + final public function __construct(?string $field = null, Rule | RuleSet ...$rules) |
|
26 | 26 | { |
27 | 27 | $this->rules = new SplObjectStorage; |
28 | 28 | $this->setField($field); |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | return new self; |
35 | 35 | } |
36 | 36 | |
37 | - public static function forField(string $field, Rule|RuleSet ...$rules): self |
|
37 | + public static function forField(string $field, Rule | RuleSet ...$rules): self |
|
38 | 38 | { |
39 | 39 | return new self($field, ...$rules); |
40 | 40 | } |
41 | 41 | |
42 | - public static function withRules(Rule|RuleSet ...$rules): self |
|
42 | + public static function withRules(Rule | RuleSet ...$rules): self |
|
43 | 43 | { |
44 | 44 | return new self(null, ...$rules); |
45 | 45 | } |
46 | 46 | |
47 | - private function attachRules(Rule|RuleSet ...$rules): void |
|
47 | + private function attachRules(Rule | RuleSet ...$rules): void |
|
48 | 48 | { |
49 | 49 | foreach ($rules as $validationOrSet) { |
50 | 50 | if ($validationOrSet instanceof Rule) { |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - public function add(Rule|RuleSet ...$rules): self |
|
62 | + public function add(Rule | RuleSet ...$rules): self |
|
63 | 63 | { |
64 | 64 | $instance = clone $this; |
65 | 65 | $instance->attachRules(...$rules); |
66 | 66 | return $instance; |
67 | 67 | } |
68 | 68 | |
69 | - public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField |
|
69 | + public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField |
|
70 | 70 | { |
71 | 71 | $violations = $empty = $this->newEmptyValidationResult(); |
72 | 72 | if (null === $input && $this->allowsNull()) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param Rule|RuleSet ...$rules |
33 | 33 | * @return $this |
34 | 34 | */ |
35 | - public function field(string $field, Rule|RuleSet ...$rules): self |
|
35 | + public function field(string $field, Rule | RuleSet ...$rules): self |
|
36 | 36 | { |
37 | 37 | $ruleSet = $this->ruleSets[$field] ?? RuleSet::forField($field); |
38 | 38 | $this->ruleSets[$field] = $ruleSet->add(...$rules); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return static |
118 | 118 | * @throws ReflectionException if the class does not exist |
119 | 119 | */ |
120 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): self |
|
120 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): self |
|
121 | 121 | { |
122 | 122 | $instance = new self; |
123 | 123 | $instance->ruleSets = RuleSetFactory::fromProperties($objectOrClass, $filter); |