@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $lazy = !empty($config['lazy']) ?? false; |
| 37 | 37 | |
| 38 | 38 | parent::__construct([ |
| 39 | - 'type' => $lazy ? function() use($name, $config, $args) { |
|
| 39 | + 'type' => $lazy ? function () use($name, $config, $args) { |
|
| 40 | 40 | return is_callable($this->type) ? ($this->type = static::_create($name, $args, $config)) : $this->type; |
| 41 | 41 | } : static::_create($name, $args, $config), |
| 42 | 42 | 'args' => $args, |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if ($arr === []) { |
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | - return array_keys($arr) !== range(0, count($arr) - 1); |
|
| 107 | + return array_keys($arr) !== range(0, count($arr)-1); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | $path[count($path)-1] = $idx; |
| 121 | 121 | $newPath = $path; |
| 122 | 122 | $newPath[] = 0; |
| 123 | - $this->_validateItems($config, $subValue, $newPath, $validate ); |
|
| 123 | + $this->_validateItems($config, $subValue, $newPath, $validate); |
|
| 124 | 124 | } else { |
| 125 | - $path[count($path) - 1] = $idx; |
|
| 125 | + $path[count($path)-1] = $idx; |
|
| 126 | 126 | $err = $validate($subValue); |
| 127 | 127 | |
| 128 | - if(empty($err)) { |
|
| 128 | + if (empty($err)) { |
|
| 129 | 129 | $wrappedType = $config['type']->getWrappedType(true); |
| 130 | 130 | $err = $this->_validate([ |
| 131 | 131 | 'type' => $wrappedType |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | try { |
| 177 | 177 | $this->_validateItems($config, $value, [0], $config['validate'] ?? [$this, "_noop"]); |
| 178 | 178 | } catch (ValidateItemsError $e) { |
| 179 | - if(isset($e->error['suberrors'])) { |
|
| 179 | + if (isset($e->error['suberrors'])) { |
|
| 180 | 180 | $err = $e->error; |
| 181 | 181 | } |
| 182 | 182 | else { |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | $fields = $type->getFields(); |
| 209 | 209 | if (is_array($value)) { |
| 210 | 210 | foreach ($value as $key => $subValue) { |
| 211 | - $config = $fields[$key]->config; |
|
| 211 | + $config = $fields[$key]->config; |
|
| 212 | 212 | $error = $this->_validate($config, $subValue); |
| 213 | 213 | |
| 214 | - if($error) { |
|
| 214 | + if ($error) { |
|
| 215 | 215 | $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error; |
| 216 | 216 | } |
| 217 | 217 | } |