Passed
Pull Request — master (#1)
by Max
02:58
created
tests/Type/ValidatedFieldDefinition/ScalarValidationTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
             'fields' => [
56 56
                 'title' => [
57 57
                     'type' => Type::string(),
58
-                    'resolve' => static function ($book) {
58
+                    'resolve' => static function($book) {
59 59
                         return $book['title'];
60 60
                     },
61 61
                 ],
62 62
                 'author' => [
63 63
                     'type' => $this->personType,
64
-                    'resolve' => static function ($book) {
64
+                    'resolve' => static function($book) {
65 65
                         return $book['author'];
66 66
                     },
67 67
                 ],
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             'query' => $this->query,
75 75
             'mutation' => new ObjectType([
76 76
                 'name' => 'Mutation',
77
-                'fields' => function () {
77
+                'fields' => function() {
78 78
                     return [
79 79
                         'updateBook' => new ValidatedFieldDefinition([
80 80
                             'name' => 'updateBook',
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                                 'bookId' => [
84 84
                                     'type' => Type::id(),
85 85
                                     'errorCodes' => ['bookNotFound'],
86
-                                    'validate' => function ($bookId) {
86
+                                    'validate' => function($bookId) {
87 87
                                         if (isset($this->data['books'][$bookId])) {
88 88
                                             return 0;
89 89
                                         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                                     },
93 93
                                 ],
94 94
                             ],
95
-                            'resolve' => static function ($value) : bool {
95
+                            'resolve' => static function($value) : bool {
96 96
                                 return !!$value;
97 97
                             },
98 98
                         ]),
Please login to merge, or discard this patch.
tests/Type/ErrorCodeTypeGenerationTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $types = [];
21 21
         new UserErrorsType([
22
-            'validate' => static function ($val) {
22
+            'validate' => static function($val) {
23 23
                 return $val ? 0 : 1;
24 24
             },
25 25
             'errorCodes' => [
26 26
                 'unknownUser',
27 27
                 'userIsMinor',
28 28
             ],
29
-            'typeSetter' => static function ($type) use (&$types): void {
29
+            'typeSetter' => static function($type) use (&$types): void {
30 30
                 $types[$type->name] = $type;
31 31
             },
32 32
             'type' => new IDType(['name' => 'User']),
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                     ],
60 60
                 ],
61 61
             ]),
62
-            'typeSetter' => static function ($type) use (&$types): void {
62
+            'typeSetter' => static function($type) use (&$types): void {
63 63
                 $types[$type->name] = $type;
64 64
             },
65 65
         ], ['updateBook']);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 'name' => 'bookInput',
82 82
                 'fields' => [
83 83
                     'authorId' => [
84
-                        'validate' => static function ($authorId) {
84
+                        'validate' => static function($authorId) {
85 85
                             return $authorId ? 0 : 1;
86 86
                         },
87 87
                         'errorCodes' => ['unknownAuthor'],
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                     ],
91 91
                 ],
92 92
             ]),
93
-            'typeSetter' => static function ($type) use (&$types): void {
93
+            'typeSetter' => static function($type) use (&$types): void {
94 94
                 $types[$type->name] = $type;
95 95
             },
96 96
         ], ['updateBook']);
Please login to merge, or discard this patch.
tests/Type/UserErrorsType/BasicTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $this->expectExceptionMessage('You must specify a type for your field');
38 38
         UserErrorsType::create([
39
-            'validate' => static function ($value) {
39
+            'validate' => static function($value) {
40 40
                 return $value ? 0 : 1;
41 41
             },
42 42
         ], ['upsertSku']);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function testValidationWithNoErrorCodes(): void
46 46
     {
47 47
         $type = UserErrorsType::create([
48
-            'validate' => static function ($value) {
48
+            'validate' => static function($value) {
49 49
                 return $value ? 0 : 1;
50 50
             },
51 51
             'type' => Type::id(),
Please login to merge, or discard this patch.
tests/Type/UserErrorsType/ListOfTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $type = new UserErrorsType([
40 40
             'type' => Type::listOf(Type::id()),
41 41
             'errorCodes'=> ['atLeastOneRequired'],
42
-            'validate' => static function ($value) {
42
+            'validate' => static function($value) {
43 43
                 return $value ? 0 : 1;
44 44
             },
45 45
         ], ['users']);
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
         $type = new UserErrorsType([
72 72
             'type' => Type::listOf(Type::listOf(Type::listOf(Type::id()))),
73 73
             'errorCodes'=> ['atLeastOneRequired'],
74
-            'validate' => static function ($value) {
74
+            'validate' => static function($value) {
75 75
                 return $value ? 0 : 1;
76 76
             },
77
-            'validateItem' => static function ($value) {
77
+            'validateItem' => static function($value) {
78 78
                 return $value ? 0 : 1;
79 79
             },
80 80
         ], ['users']);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function testListOfInputObjectWithValidationOnSelf(): void
120 120
     {
121 121
         $type = new UserErrorsType([
122
-            'validate' => static function (array $authors) {
122
+            'validate' => static function(array $authors) {
123 123
                 if (count($authors) < 1) {
124 124
                     return ['atLeastOneAuthorRequired', 'You must submit at least one author'];
125 125
                 }
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $type = new UserErrorsType([
166 166
             'suberrorCodes' => ['firstNameOrLastNameRequired'],
167
-            'validateItem' => static function (array $author) {
168
-                if (! isset($author['firstName']) && ! isset($author['lastName'])) {
167
+            'validateItem' => static function(array $author) {
168
+                if (!isset($author['firstName']) && !isset($author['lastName'])) {
169 169
                     return ['atLeastOneAuthorRequired', 'You must submit a first name or a last name'];
170 170
                 }
171 171
             },
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                 'fields' => [
175 175
                     'firstName' => [
176 176
                         'type' => Type::string(),
177
-                        'validate' => static function (string $name) {
177
+                        'validate' => static function(string $name) {
178 178
                             return $name ? 0 : 1;
179 179
                         },
180 180
                     ],
Please login to merge, or discard this patch.