Passed
Pull Request — master (#1)
by Max
02:52
created
tests/Utils.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         }
23 23
 
24 24
         // Toss out the first and last lines.
25
-        $lines = array_slice($lines, 1, count($lines) - 2);
25
+        $lines = array_slice($lines, 1, count($lines)-2);
26 26
 
27 27
         // take the tabs from the first line, and subtract them from all lines
28 28
         $matches = [];
Please login to merge, or discard this patch.
src/Type/Definition/UserErrorsType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $finalFields = $config['fields'] ?? [];
26 26
 
27
-        if (! isset($config['type'])) {
27
+        if (!isset($config['type'])) {
28 28
             throw new Exception('You must specify a type for your field');
29 29
         }
30 30
 
31 31
         GraphQL\Utils\Utils::invariant($config['type'] instanceof Type, 'Must provide type.');
32 32
 
33 33
         if (isset($config['errorCodes'])) {
34
-            if (! isset($config['validate'])) {
34
+            if (!isset($config['validate'])) {
35 35
                 throw new Exception('If you specify errorCodes, you must also provide a validate callback');
36 36
             }
37 37
 
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
             $fields = [];
66 66
             foreach ($type->getFields() as $key => $field) {
67 67
                 $newType = static::create(
68
-                    $field->config + ['typeSetter' => $config['typeSetter'] ?? null],
68
+                    $field->config+['typeSetter' => $config['typeSetter'] ?? null],
69 69
                     array_merge($path, [$key])
70 70
                 );
71 71
 
72
-                if (! $newType) {
72
+                if (!$newType) {
73 73
                     continue;
74 74
                 }
75 75
 
Please login to merge, or discard this patch.
src/Type/Definition/ValidatedFieldDefinition.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
             'name' => $name,
64 64
             'resolve' => function ($value, $args1, $context, $info) use ($config, $args) {
65 65
                 // validate inputs
66
-                $config['type']  = new InputObjectType([
66
+                $config['type'] = new InputObjectType([
67 67
                     'name'=>'',
68 68
                     'fields' => $args,
69 69
                 ]);
70 70
                 $errors          = $this->_validate($config, $args1);
71 71
                 $result          = $errors;
72
-                $result['valid'] = ! $errors;
72
+                $result['valid'] = !$errors;
73 73
 
74
-                if (! isset($result['error']) && ! isset($result['suberrors'])) {
74
+                if (!isset($result['error']) && !isset($result['suberrors'])) {
75 75
                     $result['result'] = $config['resolve']($value, $args1, $context, $info);
76 76
                 }
77 77
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         if ($arr === []) {
89 89
             return false;
90 90
         }
91
-        return array_keys($arr) !== range(0, count($arr) - 1);
91
+        return array_keys($arr) !== range(0, count($arr)-1);
92 92
     }
93 93
 
94 94
     /**
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
     protected function _validateItems(array $value, array $path, callable $validate) : void
101 101
     {
102 102
         foreach ($value as $idx => $subValue) {
103
-            if (is_array($subValue) && ! $this->_isAssoc($subValue)) {
103
+            if (is_array($subValue) && !$this->_isAssoc($subValue)) {
104 104
                 $path[count($path)-1] = $idx;
105 105
                 $newPath              = $path;
106 106
                 $newPath[]            = 0;
107 107
                 $this->_validateItems($subValue, $newPath, $validate);
108 108
             } else {
109
-                $path[count($path) - 1] = $idx;
109
+                $path[count($path)-1] = $idx;
110 110
                 $err                    = $validate($subValue);
111 111
 
112 112
                 if ($err) {
Please login to merge, or discard this patch.
tests/Type/UserErrorsType/ListOfTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
         $type = new UserErrorsType([
166 166
             'suberrorCodes' => ['firstNameOrLastNameRequired'],
167 167
             'validateItem' => static function (array $author) {
168
-                if (! isset($author['firstName']) && ! isset($author['lastName'])) {
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
             },
Please login to merge, or discard this patch.
tests/Type/ValidatedFieldDefinition/ListOfScalarValidationTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
                                     'suberrorCodes' => ['invalidPhoneNumber'],
50 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 56
                             'resolve' => static function (array $phoneNumbers) : bool {
57
-                                return ! empty($phoneNumbers);
57
+                                return !empty($phoneNumbers);
58 58
                             },
59 59
                         ]),
60 60
                     ];
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                             [
107 107
                                 'suberrors' =>
108 108
                                     [
109
-                                        'path' => [0,1],
109
+                                        'path' => [0, 1],
110 110
                                         'code' => 'invalidPhoneNumber',
111 111
                                     ],
112 112
                             ],
Please login to merge, or discard this patch.
tests/Type/ValidatedFieldDefinition/InputObjectValidationTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                         'authorDeceased',
77 77
                     ],
78 78
                     'validate' => function (string $authorId) {
79
-                        if (! isset($this->data['people'][$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;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
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/ValidatedFieldDefinition/ListOfInputObjectValidationTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                         'authorDeceased',
78 78
                     ],
79 79
                     'validate' => function (string $authorId) {
80
-                        if (! isset($this->data['people'][$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;
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
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
-                                        return isset($book['author']) || isset($book['title']) ? 0: 1;
107
+                                        return isset($book['author']) || isset($book['title']) ? 0 : 1;
108 108
                                     },
109 109
                                 ],
110 110
                             ],
Please login to merge, or discard this patch.