Passed
Push — main ( 3fb16f...8dd5f8 )
by Breno
01:41
created
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/ValidationException.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 
9 9
 class ValidationException extends Exception
10 10
 {
11
-    private ValidationResultSet|ValidationResult $violations;
11
+    private ValidationResultSet | ValidationResult $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.
src/Rules/DateTime/GreaterThan.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
26 26
         try {
27 27
             $datetime =
28 28
                 $input instanceof DateTimeInterface ?
29
-                    $input :
30
-                    new DateTimeImmutable($input);
29
+                    $input : new DateTimeImmutable($input);
31 30
 
32 31
             return $datetime > $this->datetime();
33 32
         } catch (Throwable) {
Please login to merge, or discard this patch.
src/Rules/DateTime/LessThan.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
26 26
         try {
27 27
             $datetime =
28 28
                 $input instanceof DateTimeInterface ?
29
-                    $input :
30
-                    new DateTimeImmutable($input);
29
+                    $input : new DateTimeImmutable($input);
31 30
 
32 31
             return $datetime < $this->datetime();
33 32
         } catch (Throwable) {
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[] = ValidationSet::forField($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) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @return static
81 81
      * @throws ReflectionException if the class does not exist
82 82
      */
83
-    public static function fromProperties(string|object $objectOrClass, ?int $filter = null): self
83
+    public static function fromProperties(string | object $objectOrClass, ?int $filter = null): self
84 84
     {
85 85
         $instance = new self;
86 86
         $instance->ruleSets = ValidationSet::fromProperties($objectOrClass, $filter);
Please login to merge, or discard this patch.
src/MaybeBelongsToField.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,11 +29,10 @@
 block discarded – undo
29 29
         return $this->field !== null;
30 30
     }
31 31
 
32
-    private function newEmptyValidationResult(): ValidationResult|ValidationResultByField
32
+    private function newEmptyValidationResult(): ValidationResult | ValidationResultByField
33 33
     {
34 34
         return
35 35
             $this->belongsToField() ?
36
-                new ValidationResultByField($this->getField()) :
37
-                ValidationResult::everythingIsOk();
36
+                new ValidationResultByField($this->getField()) : ValidationResult::everythingIsOk();
38 37
     }
39 38
 }
Please login to merge, or discard this patch.
src/ValidationSet.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         return $this;
49 49
     }
50 50
 
51
-    public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField
51
+    public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField
52 52
     {
53 53
         $violations = $this->newEmptyValidationResult();
54 54
         foreach ($this->rules as $constraint) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @return ValidationSet[]
90 90
      * @throws ReflectionException if the class does not exist
91 91
      */
92
-    public static function fromProperties(string|object $objectOrClass, ?int $filter = null): array
92
+    public static function fromProperties(string | object $objectOrClass, ?int $filter = null): array
93 93
     {
94 94
         $ruleSets = [];
95 95
         foreach ((new ReflectionClass($objectOrClass))->getProperties($filter) as $property) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * @return ValidationSet[]
106 106
      * @throws ReflectionException
107 107
      */
108
-    public static function fromMethods(string|object $objectOrClass, ?int $filter = null): array
108
+    public static function fromMethods(string | object $objectOrClass, ?int $filter = null): array
109 109
     {
110 110
         $ruleSets = [];
111 111
         foreach ((new ReflectionClass($objectOrClass))->getMethods($filter) as $method) {
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
      * @return static
122 122
      * @throws ReflectionException if the class or property does not exist.
123 123
      */
124
-    public static function fromProperty(string|object $objectOrClass, string $property): self
124
+    public static function fromProperty(string | object $objectOrClass, string $property): self
125 125
     {
126 126
         return self::fromReflectionProperty(new ReflectionProperty($objectOrClass, $property));
127 127
     }
128 128
 
129
-    public static function fromMethod(string|object $objectOrClass, string $method): self
129
+    public static function fromMethod(string | object $objectOrClass, string $method): self
130 130
     {
131 131
         return self::fromReflectionMethod(new ReflectionMethod($objectOrClass, $method));
132 132
     }
Please login to merge, or discard this patch.
src/Rules/DateTime/GreaterThanAnother.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@
 block discarded – undo
21 21
         try {
22 22
             $datetime =
23 23
                 $input instanceof DateTimeInterface ?
24
-                    $input :
25
-                    new DateTimeImmutable($input);
24
+                    $input : new DateTimeImmutable($input);
26 25
 
27 26
             return array_key_exists($this->other, $context)
28 27
                 && $datetime > (new DateTimeImmutable($context[$this->other]));
Please login to merge, or discard this patch.
src/Rules/DateTime/LessThanAnother.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@
 block discarded – undo
21 21
         try {
22 22
             $datetime =
23 23
                 $input instanceof DateTimeInterface ?
24
-                    $input :
25
-                    new DateTimeImmutable($input);
24
+                    $input : new DateTimeImmutable($input);
26 25
 
27 26
             return array_key_exists($this->other, $context)
28 27
                 && $datetime < (new DateTimeImmutable($context[$this->other]));
Please login to merge, or discard this patch.