@@ -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 | } |
@@ -54,8 +54,8 @@ |
||
| 54 | 54 | protected function _getType($config) { |
| 55 | 55 | $type = $config['type']; |
| 56 | 56 | if (is_callable($type)) { |
| 57 | - $type = $type(); |
|
| 58 | - } |
|
| 57 | + $type = $type(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | if ($type instanceof WrappingType) { |
| 61 | 61 | $type = $type->getWrappedType(true); |
@@ -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 | ]; |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | parent::__construct([ |
| 39 | 39 | 'type' => $lazy ? function() use($name, $config, $args) { |
| 40 | - return static::_create($name, $args, $config); |
|
| 41 | - } : static::_create($name, $args, $config), |
|
| 40 | + return static::_create($name, $args, $config); |
|
| 41 | + } : static::_create($name, $args, $config), |
|
| 42 | 42 | 'args' => $args, |
| 43 | 43 | 'name' => $name, |
| 44 | 44 | 'resolve' => function ($value, $args1, $context, $info) use ($config, $args) { |
@@ -63,33 +63,33 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | protected function _create($name, $args, $config) { |
| 66 | - return UserErrorsType::create([ |
|
| 67 | - 'errorCodes' => $config['errorCodes'] ?? null, |
|
| 68 | - 'isRoot' => true, |
|
| 69 | - 'fields' => [ |
|
| 70 | - $this->resultFieldName => [ |
|
| 71 | - 'type' => $config['type'], |
|
| 72 | - 'description' => 'The payload, if any', |
|
| 73 | - 'resolve' => static function ($value) { |
|
| 74 | - return $value['result'] ?? null; |
|
| 75 | - }, |
|
| 76 | - ], |
|
| 77 | - $this->validFieldName => [ |
|
| 78 | - 'type' => Type::nonNull(Type::boolean()), |
|
| 79 | - 'description' => 'Whether all validation passed. True for yes, false for no.', |
|
| 80 | - 'resolve' => static function ($value) { |
|
| 81 | - return $value['valid']; |
|
| 82 | - }, |
|
| 83 | - ], |
|
| 84 | - ], |
|
| 85 | - 'validate' => $config['validate'] ?? null, |
|
| 86 | - 'type' => new InputObjectType([ |
|
| 87 | - 'fields' => $args, |
|
| 88 | - 'name' => '', |
|
| 89 | - ]), |
|
| 90 | - 'typeSetter' => $config['typeSetter'] ?? null, |
|
| 91 | - ], [$name], false, ucfirst($name) . 'Result'); |
|
| 92 | - } |
|
| 66 | + return UserErrorsType::create([ |
|
| 67 | + 'errorCodes' => $config['errorCodes'] ?? null, |
|
| 68 | + 'isRoot' => true, |
|
| 69 | + 'fields' => [ |
|
| 70 | + $this->resultFieldName => [ |
|
| 71 | + 'type' => $config['type'], |
|
| 72 | + 'description' => 'The payload, if any', |
|
| 73 | + 'resolve' => static function ($value) { |
|
| 74 | + return $value['result'] ?? null; |
|
| 75 | + }, |
|
| 76 | + ], |
|
| 77 | + $this->validFieldName => [ |
|
| 78 | + 'type' => Type::nonNull(Type::boolean()), |
|
| 79 | + 'description' => 'Whether all validation passed. True for yes, false for no.', |
|
| 80 | + 'resolve' => static function ($value) { |
|
| 81 | + return $value['valid']; |
|
| 82 | + }, |
|
| 83 | + ], |
|
| 84 | + ], |
|
| 85 | + 'validate' => $config['validate'] ?? null, |
|
| 86 | + 'type' => new InputObjectType([ |
|
| 87 | + 'fields' => $args, |
|
| 88 | + 'name' => '', |
|
| 89 | + ]), |
|
| 90 | + 'typeSetter' => $config['typeSetter'] ?? null, |
|
| 91 | + ], [$name], false, ucfirst($name) . 'Result'); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | private function _noop($value) { |
| 95 | 95 | // this is just a no-op validation function to fallback to when no validation function is provided |