@@ -37,7 +37,7 @@ |
||
37 | 37 | { |
38 | 38 | $type = new UserErrorsType([ |
39 | 39 | 'errorCodes' => ['invalidColor'], |
40 | - 'validate' => static function ($value) { |
|
40 | + 'validate' => static function($value) { |
|
41 | 41 | return $value ? 0 : 1; |
42 | 42 | }, |
43 | 43 | 'type' => new IDType(['name' => 'Color']), |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | public function testFieldsWithNoErrorCodes() |
19 | 19 | { |
20 | - $type = new UserErrorsType([ |
|
20 | + $type = new UserErrorsType([ |
|
21 | 21 | 'type' => new InputObjectType([ |
22 | 22 | 'name' => 'bookInput', |
23 | 23 | 'fields' => [ |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function testFieldsWithValidate() |
65 | 65 | { |
66 | - $type = new UserErrorsType([ |
|
66 | + $type = new UserErrorsType([ |
|
67 | 67 | 'type' => new InputObjectType([ |
68 | 68 | 'name' => 'bookInput', |
69 | 69 | 'fields' => [ |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'title' => [ |
63 | 63 | 'type' => Type::string(), |
64 | 64 | 'description' => 'Enter a book title, no more than 10 characters in length', |
65 | - 'validate' => static function (string $title) { |
|
65 | + 'validate' => static function(string $title) { |
|
66 | 66 | if (strlen($title) > 10) { |
67 | 67 | return [1, 'book title must be less than 10 chaacters']; |
68 | 68 | } |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | 'unknownAuthor', |
77 | 77 | 'authorDeceased', |
78 | 78 | ], |
79 | - 'validate' => function (string $authorId) { |
|
80 | - if (! isset($this->data['people'][$authorId])) { |
|
79 | + 'validate' => function(string $authorId) { |
|
80 | + if (!isset($this->data['people'][$authorId])) { |
|
81 | 81 | return ['unknownAuthor', 'We have no record of that author']; |
82 | 82 | } |
83 | 83 | return 0; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'query' => $this->query, |
93 | 93 | 'mutation' => new ObjectType([ |
94 | 94 | 'name' => 'Mutation', |
95 | - 'fields' => function () { |
|
95 | + 'fields' => function() { |
|
96 | 96 | return [ |
97 | 97 | 'updateBooks' => new ValidatedFieldDefinition([ |
98 | 98 | 'name' => 'updateBooks', |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | 'bookAttributes' => [ |
102 | 102 | 'type' => Type::listOf($this->bookAttributesInputType), |
103 | 103 | 'validate' => static function($var) { |
104 | - return $var ? 0: 1; |
|
104 | + return $var ? 0 : 1; |
|
105 | 105 | }, |
106 | 106 | 'validateItem' => static function($book) { |
107 | - $res = isset($book['author']) || isset($book['title']) ? 0: 1; |
|
107 | + $res = isset($book['author']) || isset($book['title']) ? 0 : 1; |
|
108 | 108 | return $res; |
109 | 109 | } |
110 | 110 | ], |
111 | 111 | ], |
112 | - 'resolve' => static function ($value) : bool { |
|
112 | + 'resolve' => static function($value) : bool { |
|
113 | 113 | return !!$value; |
114 | 114 | }, |
115 | 115 | ]), |
@@ -165,21 +165,21 @@ discard block |
||
165 | 165 | static::assertEmpty($res->errors); |
166 | 166 | |
167 | 167 | static::assertEquals( |
168 | - array ( |
|
168 | + array( |
|
169 | 169 | 'valid' => false, |
170 | 170 | 'result' => NULL, |
171 | 171 | 'suberrors' => |
172 | - array ( |
|
172 | + array( |
|
173 | 173 | 'bookAttributes' => |
174 | - array ( |
|
174 | + array( |
|
175 | 175 | 'code' => NULL, |
176 | 176 | 'msg' => NULL, |
177 | 177 | 'suberrors' => |
178 | - array ( |
|
178 | + array( |
|
179 | 179 | 'code' => 1, |
180 | 180 | 'msg' => '', |
181 | 181 | 'path' => |
182 | - array ( |
|
182 | + array( |
|
183 | 183 | 0 => 1, |
184 | 184 | ), |
185 | 185 | ), |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | 'bookId' => [ |
18 | 18 | 'type' => Type::id(), |
19 | 19 | 'errorCodes' => ['bookNotFound'], |
20 | - 'validate' => function ($bookId) { |
|
20 | + 'validate' => function($bookId) { |
|
21 | 21 | return $bookId ? 0 : 1; |
22 | 22 | }, |
23 | 23 | ], |
24 | 24 | ], |
25 | - 'resolve' => static function ($value) : bool { |
|
25 | + 'resolve' => static function($value) : bool { |
|
26 | 26 | return !!$value; |
27 | 27 | }, |
28 | 28 | ]); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | 'bookId' => [ |
40 | 40 | 'type' => Type::id(), |
41 | 41 | 'errorCodes' => ['bookNotFound'], |
42 | - 'validate' => function ($bookId) { |
|
42 | + 'validate' => function($bookId) { |
|
43 | 43 | return $bookId ? 0 : 1; |
44 | 44 | }, |
45 | 45 | ], |
46 | 46 | ], |
47 | - 'resolve' => static function ($value) : bool { |
|
47 | + 'resolve' => static function($value) : bool { |
|
48 | 48 | return !!$value; |
49 | 49 | }, |
50 | 50 | ]); |