@@ -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 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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 | ]; |