Completed
Pull Request — master (#8)
by Max
06:43
created
src/Type/Definition/ValidatedFieldDefinition.php 1 patch
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                    = $validate($subValue);
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
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             try {
169 169
                 $this->_validateItems($config, $value, [0], $config['validate']);
170 170
             } catch (ValidateItemsError $e) {
171
-                if(isset($e->error['suberrors'])) {
171
+                if (isset($e->error['suberrors'])) {
172 172
                     $err = $e->error;
173 173
                 }
174 174
                 else {
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
         $fields = $type->getFields();
203 203
         if (is_array($value)) {
204 204
             foreach ($value as $key => $subValue) {
205
-                $config                 = $fields[$key]->config;
205
+                $config = $fields[$key]->config;
206 206
                 $error = $this->_validate($config, $subValue);
207 207
 
208
-                if($error) {
208
+                if ($error) {
209 209
                     $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error;
210 210
                 }
211 211
             }
Please login to merge, or discard this patch.
src/Type/Definition/UserErrorsType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $fields = [];
71 71
         foreach ($type->getFields() as $key => $field) {
72 72
             $fieldType = $this->_getType($field->config);
73
-            if($newType = static::create(
73
+            if ($newType = static::create(
74 74
                 [
75 75
                     'validate' => $field->config['validate'] ?? null,
76 76
                     'errorCodes' => $field->config['errorCodes'] ?? null,
@@ -191,7 +191,7 @@  discard block
 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.