@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | }, |
90 | 90 | ]; |
91 | 91 | |
92 | - if($createSubErrors) { |
|
92 | + if ($createSubErrors) { |
|
93 | 93 | $fields[$key] = $errType; |
94 | 94 | } |
95 | 95 | else { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | return $userErrorType; |
197 | 197 | } |
198 | 198 | |
199 | - if(count($path) == 1) { |
|
199 | + if (count($path) == 1) { |
|
200 | 200 | throw new Exception("You must specify at least one 'validate' callback somewhere"); |
201 | 201 | } |
202 | 202 |
@@ -91,8 +91,7 @@ |
||
91 | 91 | |
92 | 92 | if($createSubErrors) { |
93 | 93 | $fields[$key] = $errType; |
94 | - } |
|
95 | - else { |
|
94 | + } else { |
|
96 | 95 | $finalFields[$key] = $errType; |
97 | 96 | } |
98 | 97 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $validFieldName = $config['validName'] ?? 'valid'; |
35 | 35 | $resultFieldName = $config['resultName'] ?? 'result'; |
36 | 36 | |
37 | - foreach(array_keys($config['args']) as $key) { |
|
38 | - if($key == $validFieldName || $key == $resultFieldName) { |
|
37 | + foreach (array_keys($config['args']) as $key) { |
|
38 | + if ($key == $validFieldName || $key == $resultFieldName) { |
|
39 | 39 | throw new \Exception("'$key' is a reserved field name at the root definition."); |
40 | 40 | } |
41 | 41 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'name' => $name, |
74 | 74 | 'resolve' => function ($value, $args1, $context, $info) use ($config, $args, $validFieldName, $resultFieldName) { |
75 | 75 | // validate inputs |
76 | - $config['type'] = new InputObjectType([ |
|
76 | + $config['type'] = new InputObjectType([ |
|
77 | 77 | 'name'=>'', |
78 | 78 | 'fields' => $args, |
79 | 79 | ]); |
@@ -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 | /** |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | $newPath[] = 0; |
117 | 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 |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $fields = $type->getFields(); |
199 | 199 | if (is_array($value)) { |
200 | 200 | foreach ($value as $key => $subValue) { |
201 | - $config = $fields[$key]->config; |
|
201 | + $config = $fields[$key]->config; |
|
202 | 202 | $res['errors'][$key] = $this->_validate($config, $subValue); |
203 | 203 | } |
204 | 204 | $res['errors'] = array_filter($res['errors'] ?? []); |