Passed
Branch master (42ef7c)
by Breno
11:20
created
Category
src/GuardForValidation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 {
8 8
     public function validateOrFail($input, array $context = [], string $message = 'Validation errors'): void
9 9
     {
10
-        if (! $this instanceof Validation) {
10
+        if (!$this instanceof Validation) {
11 11
             return;
12 12
         }
13 13
 
Please login to merge, or discard this patch.
src/Validator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         return $this->ruleSets[] = (new ValidationSet)->setField($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) {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      * @return static
80 80
      * @throws ReflectionException
81 81
      */
82
-    public static function fromProperties(string|object $objectOrClass): self
82
+    public static function fromProperties(string | object $objectOrClass): self
83 83
     {
84 84
         $instance = new self;
85 85
         $instance->ruleSets = ValidationSet::fromProperties($objectOrClass);
Please login to merge, or discard this patch.
src/ValidationSet.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         return $this;
32 32
     }
33 33
 
34
-    public function validate($input, array $context = []): ValidationResult|ValidationResultByField
34
+    public function validate($input, array $context = []): ValidationResult | ValidationResultByField
35 35
     {
36 36
         $violations = $this->newEmptyValidationResult();
37 37
         foreach ($this->rules as $constraint) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @return array
72 72
      * @throws ReflectionException
73 73
      */
74
-    public static function fromProperties(string|object $objectOrClass): array
74
+    public static function fromProperties(string | object $objectOrClass): array
75 75
     {
76 76
         $ruleSets = [];
77 77
         foreach ((new ReflectionClass($objectOrClass))->getProperties() as $property) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @return static
88 88
      * @throws ReflectionException
89 89
      */
90
-    public static function fromProperty(string|object $objectOrClass, string $property): self
90
+    public static function fromProperty(string | object $objectOrClass, string $property): self
91 91
     {
92 92
         return self::fromReflectionProperty(new ReflectionProperty($objectOrClass, $property));
93 93
     }
Please login to merge, or discard this patch.
src/Rules/AbstractValidation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function validate($input, array $context = []): Result
24 24
     {
25 25
         $result = $this->newEmptyValidationResult();
26
-        return $this->isValid($input, $context) ? $result: $result->error($this->message);
26
+        return $this->isValid($input, $context) ? $result : $result->error($this->message);
27 27
     }
28 28
 
29 29
     abstract protected function isValid($input, array $context = []): bool;
Please login to merge, or discard this patch.
src/MaybeBelongsToField.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
         return $this->field !== null;
24 24
     }
25 25
 
26
-    private function newEmptyValidationResult(): ValidationResult|ValidationResultByField
26
+    private function newEmptyValidationResult(): ValidationResult | ValidationResultByField
27 27
     {
28 28
         return $this->belongsToField() ? new ValidationResultByField($this->getField()) : new ValidationResult;
29 29
     }
Please login to merge, or discard this patch.
src/ValidationException.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     private Result $violations;
12 12
 
13 13
     public function __construct(
14
-        ValidationResultSet|ValidationResult $violations,
14
+        ValidationResultSet | ValidationResult $violations,
15 15
         ?string $message = null,
16 16
         $code = 422,
17 17
         Throwable $previous = null
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         return
29 29
             $this->violations instanceof ValidationResultSet ?
30
-                $this->violations->validationResults() :
31
-                [$this->violations];
30
+                $this->violations->validationResults() : [$this->violations];
32 31
     }
33 32
 
34 33
     private function formatMessage(): string
@@ -41,6 +40,6 @@  discard block
 block discarded – undo
41 40
             }
42 41
         }
43 42
 
44
-        return "Validation errors:" . PHP_EOL . implode(PHP_EOL, $messages);
43
+        return "Validation errors:".PHP_EOL.implode(PHP_EOL, $messages);
45 44
     }
46 45
 }
Please login to merge, or discard this patch.