@@ -191,7 +191,7 @@ |
||
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 |
@@ -107,8 +107,7 @@ |
||
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 | } |
@@ -169,8 +169,7 @@ |
||
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 | ]; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if ($arr === []) { |
99 | 99 | return false; |
100 | 100 | } |
101 | - return array_keys($arr) !== range(0, count($arr) - 1); |
|
101 | + return array_keys($arr) !== range(0, count($arr)-1); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | $path[count($path)-1] = $idx; |
115 | 115 | $newPath = $path; |
116 | 116 | $newPath[] = 0; |
117 | - $this->_validateItems($config, $subValue, $newPath, $validate ); |
|
117 | + $this->_validateItems($config, $subValue, $newPath, $validate); |
|
118 | 118 | } else { |
119 | - $path[count($path) - 1] = $idx; |
|
119 | + $path[count($path)-1] = $idx; |
|
120 | 120 | $err = $validate($subValue); |
121 | 121 | |
122 | - if(empty($err)) { |
|
122 | + if (empty($err)) { |
|
123 | 123 | $wrappedType = $config['type']->getWrappedType(true); |
124 | 124 | $err = $this->_validate([ |
125 | 125 | 'type' => $wrappedType |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | try { |
171 | 171 | $this->_validateItems($config, $value, [0], $config['validate'] ?? [$this, "_noop"]); |
172 | 172 | } catch (ValidateItemsError $e) { |
173 | - if(isset($e->error['suberrors'])) { |
|
173 | + if (isset($e->error['suberrors'])) { |
|
174 | 174 | $err = $e->error; |
175 | 175 | } |
176 | 176 | else { |
@@ -202,10 +202,10 @@ discard block |
||
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 | } |