Test Failed
Push — master ( f5b9ec...fae9cb )
by Max
18:11
created
src/Type/Definition/UserErrorsType.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
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->getInnermostType();
Please login to merge, or discard this patch.
src/Type/Definition/ValidatedFieldDefinition.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,8 +169,7 @@
 block discarded – undo
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
                 ];
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
         parent::__construct([
38 38
             'type' => function() use($name, $config, $args) {
39
-				return static::_create($name, $args, $config);
40
-			},
39
+                return static::_create($name, $args, $config);
40
+            },
41 41
             'args' => $args,
42 42
             'name' => $name,
43 43
             'resolve' => function ($value, $args1, $context, $info) use ($config, $args) {
@@ -62,33 +62,33 @@  discard block
 block discarded – undo
62 62
     }
63 63
 
64 64
     protected function _create($name, $args, $config) {
65
-		return UserErrorsType::create([
66
-			'errorCodes' => $config['errorCodes'] ?? null,
67
-			'isRoot' => true,
68
-			'fields' => [
69
-				$this->resultFieldName => [
70
-					'type' => $config['type'],
71
-					'description' => 'The payload, if any',
72
-					'resolve' => static function ($value) {
73
-						return $value['result'] ?? null;
74
-					},
75
-				],
76
-				$this->validFieldName => [
77
-					'type' => Type::nonNull(Type::boolean()),
78
-					'description' => 'Whether all validation passed. True for yes, false for no.',
79
-					'resolve' => static function ($value) {
80
-						return $value['valid'];
81
-					},
82
-				],
83
-			],
84
-			'validate' => $config['validate'] ?? null,
85
-			'type' => new InputObjectType([
86
-				'fields' => $args,
87
-				'name' => '',
88
-			]),
89
-			'typeSetter' => $config['typeSetter'] ?? null,
90
-		], [$name], false, ucfirst($name) . 'Result');
91
-	}
65
+        return UserErrorsType::create([
66
+            'errorCodes' => $config['errorCodes'] ?? null,
67
+            'isRoot' => true,
68
+            'fields' => [
69
+                $this->resultFieldName => [
70
+                    'type' => $config['type'],
71
+                    'description' => 'The payload, if any',
72
+                    'resolve' => static function ($value) {
73
+                        return $value['result'] ?? null;
74
+                    },
75
+                ],
76
+                $this->validFieldName => [
77
+                    'type' => Type::nonNull(Type::boolean()),
78
+                    'description' => 'Whether all validation passed. True for yes, false for no.',
79
+                    'resolve' => static function ($value) {
80
+                        return $value['valid'];
81
+                    },
82
+                ],
83
+            ],
84
+            'validate' => $config['validate'] ?? null,
85
+            'type' => new InputObjectType([
86
+                'fields' => $args,
87
+                'name' => '',
88
+            ]),
89
+            'typeSetter' => $config['typeSetter'] ?? null,
90
+        ], [$name], false, ucfirst($name) . 'Result');
91
+    }
92 92
 
93 93
     private function _noop($value) {
94 94
         // this is just a no-op validation function to fallback to when no validation function is provided
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->resultFieldName = $config['resultName'] ?? 'result';
36 36
 
37 37
         parent::__construct([
38
-            'type' => function() use($name, $config, $args) {
38
+            'type' => function () use($name, $config, $args) {
39 39
 				return static::_create($name, $args, $config);
40 40
 			},
41 41
             'args' => $args,
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         if ($arr === []) {
104 104
             return false;
105 105
         }
106
-        return array_keys($arr) !== range(0, count($arr) - 1);
106
+        return array_keys($arr) !== range(0, count($arr)-1);
107 107
     }
108 108
 
109 109
     /**
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
                 $path[count($path)-1] = $idx;
120 120
                 $newPath              = $path;
121 121
                 $newPath[]            = 0;
122
-                $this->_validateItems($config, $subValue, $newPath, $validate );
122
+                $this->_validateItems($config, $subValue, $newPath, $validate);
123 123
             } else {
124
-                $path[count($path) - 1] = $idx;
124
+                $path[count($path)-1] = $idx;
125 125
                 $err                    = $validate($subValue);
126 126
 
127
-                if(empty($err)) {
127
+                if (empty($err)) {
128 128
                     $wrappedType = $config['type']->getInnermostType();
129 129
                     $err = $this->_validate([
130 130
                         'type' => $wrappedType
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $res = [];
149 149
 	    
150 150
         if (is_callable($arg['type'])) {
151
-            $arg['type'] =  $arg['type']();
151
+            $arg['type'] = $arg['type']();
152 152
         }
153 153
 
154 154
         $type = $arg['type'];
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         try {
180 180
             $this->_validateItems($config, $value, [0], $config['validate'] ?? [$this, "_noop"]);
181 181
         } catch (ValidateItemsError $e) {
182
-            if(isset($e->error['suberrors'])) {
182
+            if (isset($e->error['suberrors'])) {
183 183
                 $err = $e->error;
184 184
             }
185 185
             else {
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
         $fields = $type->getFields();
212 212
         if (is_array($value)) {
213 213
             foreach ($value as $key => $subValue) {
214
-                $config                 = $fields[$key]->config;
214
+                $config = $fields[$key]->config;
215 215
                 $error = $this->_validate($config, $subValue);
216 216
 
217
-                if($error) {
217
+                if ($error) {
218 218
                     $createSubErrors ? $res[UserErrorsType::SUBERRORS_NAME][$key] = $error : $res[$key] = $error;
219 219
                 }
220 220
             }
Please login to merge, or discard this patch.