@@ -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); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | { |
8 | 8 | public function validateOrFail($input, array $context = [], ?string $message = null): void |
9 | 9 | { |
10 | - if (! $this instanceof Rule) { |
|
10 | + if (!$this instanceof Rule) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | trait ComparisonFactory |
11 | 11 | { |
12 | - abstract public function add(Rule|RuleSet ...$rules): RuleSet; |
|
12 | + abstract public function add(Rule | RuleSet ...$rules): RuleSet; |
|
13 | 13 | |
14 | 14 | public function equal($value, ?string $message = null): RuleSet |
15 | 15 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $number = substr($stringInput, 0, -1); |
33 | 33 | $digit = (int) substr($stringInput, -1); |
34 | 34 | return |
35 | - $digit === match ($this->algorithm) { |
|
35 | + $digit === match($this->algorithm) { |
|
36 | 36 | self::MOD11 => self::mod11($number), |
37 | 37 | self::MOD10 => self::mod10($number), |
38 | 38 | default => throw new InvalidArgumentException('Algoritmo de cálculo de dígito inválido') |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $sum += $number * $factor[$i++ % $size]; |
50 | 50 | } |
51 | 51 | |
52 | - $mod11 = ($sum * 10 ) % 11; |
|
52 | + $mod11 = ($sum * 10) % 11; |
|
53 | 53 | return $modReturn[$mod11] ?? 11 - $mod11; |
54 | 54 | } |
55 | 55 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | $modReturn = [0 => 0, 1 => 0]; |
77 | 77 | $digit1 = DigitoVerificador::mod11($number, $modReturn); |
78 | - $digit2 = DigitoVerificador::mod11($number . $digit1, $modReturn); |
|
78 | + $digit2 = DigitoVerificador::mod11($number.$digit1, $modReturn); |
|
79 | 79 | |
80 | - return $digits === ($digit1 . $digit2); |
|
80 | + return $digits === ($digit1.$digit2); |
|
81 | 81 | } |
82 | 82 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @throws ValidationException |
27 | 27 | */ |
28 | - final public function __construct(?string $field = null, Rule|RuleSet ...$rules) |
|
28 | + final public function __construct(?string $field = null, Rule | RuleSet ...$rules) |
|
29 | 29 | { |
30 | 30 | $this->rules = new SplObjectStorage; |
31 | 31 | $this->setField($field); |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | return new self; |
38 | 38 | } |
39 | 39 | |
40 | - public static function forField(string $field, Rule|RuleSet ...$rules): self |
|
40 | + public static function forField(string $field, Rule | RuleSet ...$rules): self |
|
41 | 41 | { |
42 | 42 | return new self($field, ...$rules); |
43 | 43 | } |
44 | 44 | |
45 | - public static function withRules(Rule|RuleSet ...$rules): self |
|
45 | + public static function withRules(Rule | RuleSet ...$rules): self |
|
46 | 46 | { |
47 | 47 | return new self(null, ...$rules); |
48 | 48 | } |
49 | 49 | |
50 | - private function attachRules(Rule|RuleSet ...$rules): void |
|
50 | + private function attachRules(Rule | RuleSet ...$rules): void |
|
51 | 51 | { |
52 | 52 | foreach ($rules as $validationOrSet) { |
53 | 53 | if ($validationOrSet instanceof Rule) { |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - public function add(Rule|RuleSet ...$rules): self |
|
65 | + public function add(Rule | RuleSet ...$rules): self |
|
66 | 66 | { |
67 | 67 | $instance = clone $this; |
68 | 68 | $instance->attachRules(...$rules); |
69 | 69 | return $instance; |
70 | 70 | } |
71 | 71 | |
72 | - public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField |
|
72 | + public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField |
|
73 | 73 | { |
74 | 74 | $violations = $empty = $this->newEmptyValidationResult(); |
75 | 75 | if (!$this->shouldValidate($input)) { |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | trait CommonFactory |
11 | 11 | { |
12 | - abstract public function add(Rule|RuleSet ...$rules): RuleSet; |
|
12 | + abstract public function add(Rule | RuleSet ...$rules): RuleSet; |
|
13 | 13 | |
14 | 14 | public function check(callable $rule, ?string $message = null): RuleSet |
15 | 15 | { |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | trait DateTimeFactory |
14 | 14 | { |
15 | - abstract public function add(Rule|RuleSet ...$rules): RuleSet; |
|
15 | + abstract public function add(Rule | RuleSet ...$rules): RuleSet; |
|
16 | 16 | |
17 | 17 | public function isPast(?string $message = null): RuleSet |
18 | 18 | { |