Passed
Pull Request — master (#8)
by Max
04:12
created
src/Type/Definition/UserErrorsType.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
             return $userErrorType;
192 192
         }
193 193
 
194
-        if(count($path) == 1) {
194
+        if (count($path) == 1) {
195 195
             throw new Exception("You must specify at least one 'validate' callback somewhere");
196 196
         }
197 197
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,7 @@
 block discarded – undo
107 107
                     return $value[static::SUBERRORS_NAME] ?? null;
108 108
                 },
109 109
             ];
110
-        }
111
-        else {
110
+        } else {
112 111
             $finalFields += $fields;
113 112
         }
114 113
     }
Please login to merge, or discard this patch.
src/Type/Definition/ValidatedFieldDefinition.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         if ($arr === []) {
94 94
             return false;
95 95
         }
96
-        return array_keys($arr) !== range(0, count($arr) - 1);
96
+        return array_keys($arr) !== range(0, count($arr)-1);
97 97
     }
98 98
 
99 99
     /**
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
                 $newPath[]            = 0;
112 112
                 $this->_validateItems($config, $subValue, $newPath, $validate);
113 113
             } else {
114
-                $path[count($path) - 1] = $idx;
114
+                $path[count($path)-1] = $idx;
115 115
                 $err                    = is_callable($validate) ? $validate($subValue) : null;
116 116
 
117
-                if(empty($err)) {
117
+                if (empty($err)) {
118 118
                     $wrappedType = $config['type']->getWrappedType(true);
119 119
                     $err = $this->_validate([
120 120
                         'type' => $wrappedType
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         try {
168 168
             $this->_validateItems($config, $value, [0], $config['validate'] ?? null);
169 169
         } catch (ValidateItemsError $e) {
170
-            if(isset($e->error['suberrors'])) {
170
+            if (isset($e->error['suberrors'])) {
171 171
                 $err = $e->error;
172 172
             }
173 173
             else {
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
         $fields = $type->getFields();
200 200
         if (is_array($value)) {
201 201
             foreach ($value as $key => $subValue) {
202
-                $config                 = $fields[$key]->config;
202
+                $config = $fields[$key]->config;
203 203
                 $error = $this->_validate($config, $subValue);
204 204
 
205
-                if($error) {
205
+                if ($error) {
206 206
                     $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error;
207 207
                 }
208 208
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,8 +169,7 @@
 block discarded – undo
169 169
         } catch (ValidateItemsError $e) {
170 170
             if(isset($e->error['suberrors'])) {
171 171
                 $err = $e->error;
172
-            }
173
-            else {
172
+            } else {
174 173
                 $err = [
175 174
                     'error' => $e->error,
176 175
                 ];
Please login to merge, or discard this patch.