Passed
Pull Request — master (#1)
by Max
05:10
created
tests/Type/ValidatedFieldDefinition/ListOfScalarValidationTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
             'query' => $this->query,
32 32
             'mutation' => new ObjectType([
33 33
                 'name' => 'Mutation',
34
-                'fields' => static function () {
34
+                'fields' => static function() {
35 35
                     return [
36 36
                         'setPhoneNumbers' => new ValidatedFieldDefinition([
37 37
                             'name' => 'setPhoneNumbers',
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
40 40
                                 'phoneNumbers' => [
41 41
                                     'type' => Type::listOf(Type::listOf(Type::string())),
42 42
                                     'errorCodes' => ['atLeastOneList'],
43
-                                    'validate' => static function (array $phoneNumberLists) {
43
+                                    'validate' => static function(array $phoneNumberLists) {
44 44
                                         if (count($phoneNumberLists) < 1) {
45 45
                                             return ['atLeastOneList', 'You must submit at least one list of numbers'];
46 46
                                         }
47 47
                                         return 0;
48 48
                                     },
49 49
                                     'suberrorCodes' => ['invalidPhoneNumber'],
50
-                                    'validateItem' => static function ($phoneNumber) {
50
+                                    'validateItem' => static function($phoneNumber) {
51 51
                                         $res = preg_match('/^[0-9\-]+$/', $phoneNumber) === 1;
52
-                                        return ! $res ? ['invalidPhoneNumber', 'That does not seem to be a valid phone number'] : 0;
52
+                                        return !$res ? ['invalidPhoneNumber', 'That does not seem to be a valid phone number'] : 0;
53 53
                                     },
54 54
                                 ],
55 55
                             ],
56
-                            'resolve' => static function (array $phoneNumbers, $args) : bool {
56
+                            'resolve' => static function(array $phoneNumbers, $args) : bool {
57 57
                                 // ...
58 58
                                 // stash them somewhere
59 59
                                 // ...
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                             [
111 111
                                 'suberrors' =>
112 112
                                     [
113
-                                        'path' => [0,1],
113
+                                        'path' => [0, 1],
114 114
                                         'code' => 'invalidPhoneNumber',
115 115
                                     ],
116 116
                             ],
Please login to merge, or discard this patch.
tests/Type/ValidatedFieldDefinition/BasicTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
                 'bookId' => [
18 18
                     'type' => Type::id(),
19 19
                     'errorCodes' => ['bookNotFound'],
20
-                    'validate' => static function ($bookId) {
20
+                    'validate' => static function($bookId) {
21 21
                         return $bookId ? 0 : 1;
22 22
                     },
23 23
                 ],
24 24
             ],
25
-            'resolve' => static function ($value) : bool {
26
-                return ! ! $value;
25
+            'resolve' => static function($value) : bool {
26
+                return !!$value;
27 27
             },
28 28
         ]);
29 29
 
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
                 'bookId' => [
40 40
                     'type' => Type::id(),
41 41
                     'errorCodes' => ['bookNotFound'],
42
-                    'validate' => static function ($bookId) {
42
+                    'validate' => static function($bookId) {
43 43
                         return $bookId ? 0 : 1;
44 44
                     },
45 45
                 ],
46 46
             ],
47
-            'resolve' => static function ($value) : bool {
48
-                return ! ! $value;
47
+            'resolve' => static function($value) : bool {
48
+                return !!$value;
49 49
             },
50 50
         ]);
51 51
 
Please login to merge, or discard this patch.
tests/Type/ValidatedFieldDefinition/InputObjectValidationTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 'title' => [
62 62
                     'type' => Type::string(),
63 63
                     'description' => 'Enter a book title, no more than 10 characters in length',
64
-                    'validate' => static function (string $title) {
64
+                    'validate' => static function(string $title) {
65 65
                         if (strlen($title) > 10) {
66 66
                             return [1, 'book title must be less than 10 chaacters'];
67 67
                         }
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
                         'unknownAuthor',
76 76
                         'authorDeceased',
77 77
                     ],
78
-                    'validate' => function (string $authorId) {
79
-                        if (! isset($this->data['people'][$authorId])) {
78
+                    'validate' => function(string $authorId) {
79
+                        if (!isset($this->data['people'][$authorId])) {
80 80
                             return ['unknownAuthor', 'We have no record of that author'];
81 81
                         }
82 82
                         return 0;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'query' => $this->query,
92 92
             'mutation' => new ObjectType([
93 93
                 'name' => 'Mutation',
94
-                'fields' => function () {
94
+                'fields' => function() {
95 95
                     return [
96 96
                         'updateBook' => new ValidatedFieldDefinition([
97 97
                             'name' => 'updateBook',
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                                 'bookAttributes' => [
101 101
                                     'type' => $this->bookAttributesInputType,
102 102
                                     'errorCodes' => ['titleOrIdRequired'],
103
-                                    'validate' => static function (?array $bookAttributes) {
103
+                                    'validate' => static function(?array $bookAttributes) {
104 104
                                         if ($bookAttributes === null) {
105 105
                                             return 0;
106 106
                                         }
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
                                     },
113 113
                                 ],
114 114
                             ],
115
-                            'resolve' => static function ($value, $args) : bool {
115
+                            'resolve' => static function($value, $args) : bool {
116 116
                                 // ...
117 117
                                 // do update
118 118
                                 // ...
119 119
 
120
-                                return ! $value;
120
+                                return !$value;
121 121
                             },
122 122
                         ]),
123 123
                     ];
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) {
29
+            'typeSetter' => static function($type) use (&$types) {
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) {
62
+            'typeSetter' => static function($type) use (&$types) {
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) {
93
+            'typeSetter' => static function($type) use (&$types) {
94 94
                 $types[$type->name] = $type;
95 95
             },
96 96
         ], ['updateBook']);
Please login to merge, or discard this patch.