@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return RuleSet[] |
17 | 17 | * @throws ReflectionException if the class does not exist |
18 | 18 | */ |
19 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): array |
|
19 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): array |
|
20 | 20 | { |
21 | 21 | $ruleSets = []; |
22 | 22 | foreach ((new ReflectionClass($objectOrClass))->getProperties($filter) as $property) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return RuleSet[] |
33 | 33 | * @throws ReflectionException |
34 | 34 | */ |
35 | - public static function fromMethods(string|object $objectOrClass, ?int $filter = null): array |
|
35 | + public static function fromMethods(string | object $objectOrClass, ?int $filter = null): array |
|
36 | 36 | { |
37 | 37 | $ruleSets = []; |
38 | 38 | foreach ((new ReflectionClass($objectOrClass))->getMethods($filter) as $method) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return RuleSet |
49 | 49 | * @throws ReflectionException if the class or property does not exist. |
50 | 50 | */ |
51 | - public static function fromProperty(string|object $objectOrClass, string $property): RuleSet |
|
51 | + public static function fromProperty(string | object $objectOrClass, string $property): RuleSet |
|
52 | 52 | { |
53 | 53 | return self::fromReflectionProperty(new ReflectionProperty($objectOrClass, $property)); |
54 | 54 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return RuleSet |
60 | 60 | * @throws ReflectionException |
61 | 61 | */ |
62 | - public static function fromMethod(string|object $objectOrClass, string $method): RuleSet |
|
62 | + public static function fromMethod(string | object $objectOrClass, string $method): RuleSet |
|
63 | 63 | { |
64 | 64 | return self::fromReflectionMethod(new ReflectionMethod($objectOrClass, $method)); |
65 | 65 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @throws ValidationException if the field is provided and is blank |
22 | 22 | */ |
23 | - final public function __construct(?string $field = null, Rule|RuleSet ...$rules) |
|
23 | + final public function __construct(?string $field = null, Rule | RuleSet ...$rules) |
|
24 | 24 | { |
25 | 25 | $this->rules = new SplObjectStorage; |
26 | 26 | $this->setField($field); |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | return new self; |
33 | 33 | } |
34 | 34 | |
35 | - public static function forField(string $field, Rule|RuleSet ...$rules): self |
|
35 | + public static function forField(string $field, Rule | RuleSet ...$rules): self |
|
36 | 36 | { |
37 | 37 | return new self($field, ...$rules); |
38 | 38 | } |
39 | 39 | |
40 | - public static function withRules(Rule|RuleSet ...$rules): self |
|
40 | + public static function withRules(Rule | RuleSet ...$rules): self |
|
41 | 41 | { |
42 | 42 | return new self(null, ...$rules); |
43 | 43 | } |
44 | 44 | |
45 | - public function add(Rule|RuleSet ...$rules): self |
|
45 | + public function add(Rule | RuleSet ...$rules): self |
|
46 | 46 | { |
47 | 47 | foreach ($rules as $validationOrSet) { |
48 | 48 | if ($validationOrSet instanceof Rule) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | |
62 | - public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField |
|
62 | + public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField |
|
63 | 63 | { |
64 | 64 | $violations = $empty = $this->newEmptyValidationResult(); |
65 | 65 | if (null === $input && $this->allowsNull()) { |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | return new self; |
17 | 17 | } |
18 | 18 | |
19 | - public function ruleSet(string $field, Rule|RuleSet ...$rules): RuleSet |
|
19 | + public function ruleSet(string $field, Rule | RuleSet ...$rules): RuleSet |
|
20 | 20 | { |
21 | 21 | $ruleSet = $this->ruleSets[$field] ?? $this->ruleSets[$field] = RuleSet::forField($field); |
22 | 22 | return $ruleSet->add(...$rules); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return static |
101 | 101 | * @throws ReflectionException if the class does not exist |
102 | 102 | */ |
103 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): self |
|
103 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): self |
|
104 | 104 | { |
105 | 105 | $instance = new self; |
106 | 106 | $instance->ruleSets = RuleSetFactory::fromProperties($objectOrClass, $filter); |
@@ -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 Rule) { |
|
10 | + if (!$this instanceof Rule) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 |