@@ -33,7 +33,7 @@ |
||
33 | 33 | $error['field'] ?? '_error', |
34 | 34 | $error['message'], |
35 | 35 | $error['type'] ?? '' |
36 | - ) . PHP_EOL; |
|
36 | + ).PHP_EOL; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $errors; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | /** @inheritDoc */ |
55 | 55 | public function validate(mixed $input, array $context = []): ErrorReporting |
56 | 56 | { |
57 | - if (! $this->shouldValidate($input)) { |
|
57 | + if (!$this->shouldValidate($input)) { |
|
58 | 58 | return ErrorReporting::success(); |
59 | 59 | } |
60 | 60 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | private function stopSign(Rule $rule, Result $result): int |
80 | 80 | { |
81 | - if (! $rule instanceof Stoppable) { |
|
81 | + if (!$rule instanceof Stoppable) { |
|
82 | 82 | return StopSign::DONT_STOP; |
83 | 83 | } |
84 | 84 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param Rule|RuleSet ...$rules |
40 | 40 | * @return $this |
41 | 41 | */ |
42 | - public function field(string $field, Rule|RuleSet ...$rules): self |
|
42 | + public function field(string $field, Rule | RuleSet ...$rules): self |
|
43 | 43 | { |
44 | 44 | $ruleSet = $this->ruleSets[$field] ?? RuleSet::of($field); |
45 | 45 | $this->ruleSets[$field] = $ruleSet->add(...$rules); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $errorReporting = new ErrorReporting; |
53 | 53 | foreach ($this->ruleSets as $field => $fieldRuleSet) { |
54 | 54 | $fieldRuleSet = $fieldRuleSet->withField($field); |
55 | - if (! $this->shouldValidate($fieldRuleSet, $data)) { |
|
55 | + if (!$this->shouldValidate($fieldRuleSet, $data)) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
@@ -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); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | protected function setStopSign(int $stopSign): void |
20 | 20 | { |
21 | - if (! in_array($stopSign, StopSign::allowed())) { |
|
21 | + if (!in_array($stopSign, StopSign::allowed())) { |
|
22 | 22 | throw new InvalidArgumentException(sprintf('Invalid stop sign (%s)', $stopSign)); |
23 | 23 | } |
24 | 24 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | use BelongsToField, StopOnFailure, Priority; |
22 | 22 | |
23 | 23 | public function __construct( |
24 | - private object|string $objectOrClass, |
|
24 | + private object | string $objectOrClass, |
|
25 | 25 | private string $property, |
26 | 26 | int $stopOnFailure = StopSign::DONT_STOP, |
27 | 27 | int $priority = Prioritable::LOWEST_PRIORITY |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | return |
43 | 43 | $this->hasOwnMessage() ? |
44 | - Translator::translate(static::MESSAGE) : |
|
45 | - Translator::translate(static::MESSAGE, $this->className()); |
|
44 | + Translator::translate(static::MESSAGE) : Translator::translate(static::MESSAGE, $this->className()); |
|
46 | 45 | } |
47 | 46 | |
48 | 47 | /** @inheritDoc */ |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | { |
51 | 50 | return |
52 | 51 | $this->isValid($input, $context) ? |
53 | - ErrorReporting::success() : |
|
54 | - (new ErrorReporting)->addError($this->message(), $this->getField(), $this); |
|
52 | + ErrorReporting::success() : (new ErrorReporting)->addError($this->message(), $this->getField(), $this); |
|
55 | 53 | } |
56 | 54 | |
57 | 55 | protected function className(): string |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public static function sortByPriority(array &$haystack): void |
30 | 30 | { |
31 | - uasort($haystack, function ($a, $b) { |
|
31 | + uasort($haystack, function($a, $b) { |
|
32 | 32 | $prorityOfA = $a instanceof Prioritable ? $a->getPriority() : Prioritable::LOWEST_PRIORITY; |
33 | 33 | $prorityOfB = $b instanceof Prioritable ? $b->getPriority() : Prioritable::LOWEST_PRIORITY; |
34 | 34 |