Passed
Pull Request — master (#604)
by Šimon
06:10
created
src/Validator/Rules/ProvidedRequiredArgumentsOnDirectives.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 
46 46
         foreach ($definedDirectives as $directive) {
47 47
             $requiredArgsMap[$directive->name] = Utils::keyMap(
48
-                array_filter($directive->args, static function (FieldArgument $arg) : bool {
49
-                    return $arg->getType() instanceof NonNull && ! isset($arg->defaultValue);
48
+                array_filter($directive->args, static function(FieldArgument $arg) : bool {
49
+                    return $arg->getType() instanceof NonNull && !isset($arg->defaultValue);
50 50
                 }),
51
-                static function (FieldArgument $arg) : string {
51
+                static function(FieldArgument $arg) : string {
52 52
                     return $arg->name;
53 53
                 }
54 54
             );
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         $astDefinition = $context->getDocument()->definitions;
58 58
         foreach ($astDefinition as $def) {
59
-            if (! ($def instanceof DirectiveDefinitionNode)) {
59
+            if (!($def instanceof DirectiveDefinitionNode)) {
60 60
                 continue;
61 61
             }
62 62
 
@@ -70,32 +70,32 @@  discard block
 block discarded – undo
70 70
 
71 71
             $requiredArgsMap[$def->name->value] = Utils::keyMap(
72 72
                 $arguments
73
-                    ? array_filter($arguments, static function (Node $argument) : bool {
73
+                    ? array_filter($arguments, static function(Node $argument) : bool {
74 74
                         return $argument instanceof NonNullTypeNode &&
75 75
                             (
76
-                                ! isset($argument->defaultValue) ||
76
+                                !isset($argument->defaultValue) ||
77 77
                                 $argument->defaultValue === null
78 78
                             );
79 79
                     })
80 80
                     : [],
81
-                static function (NamedTypeNode $argument) : string {
81
+                static function(NamedTypeNode $argument) : string {
82 82
                     return $argument->name->value;
83 83
                 }
84 84
             );
85 85
         }
86 86
 
87 87
         return [
88
-            NodeKind::DIRECTIVE => static function (DirectiveNode $directiveNode) use ($requiredArgsMap, $context) {
88
+            NodeKind::DIRECTIVE => static function(DirectiveNode $directiveNode) use ($requiredArgsMap, $context) {
89 89
                 $directiveName = $directiveNode->name->value;
90 90
                 $requiredArgs  = $requiredArgsMap[$directiveName] ?? null;
91
-                if (! $requiredArgs) {
91
+                if (!$requiredArgs) {
92 92
                     return null;
93 93
                 }
94 94
 
95 95
                 $argNodes   = $directiveNode->arguments ?: [];
96 96
                 $argNodeMap = Utils::keyMap(
97 97
                     $argNodes,
98
-                    static function (ArgumentNode $arg) : string {
98
+                    static function(ArgumentNode $arg) : string {
99 99
                         return $arg->name->value;
100 100
                     }
101 101
                 );
Please login to merge, or discard this patch.
src/Validator/Rules/ProvidedRequiredArguments.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
     {
20 20
         return [
21 21
             NodeKind::FIELD     => [
22
-                'leave' => static function (FieldNode $fieldNode) use ($context) {
22
+                'leave' => static function(FieldNode $fieldNode) use ($context) {
23 23
                     $fieldDef = $context->getFieldDef();
24 24
 
25
-                    if (! $fieldDef) {
25
+                    if (!$fieldDef) {
26 26
                         return Visitor::skipNode();
27 27
                     }
28 28
                     $argNodes = $fieldNode->arguments ?: [];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                     }
34 34
                     foreach ($fieldDef->args as $argDef) {
35 35
                         $argNode = $argNodeMap[$argDef->name] ?? null;
36
-                        if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) {
36
+                        if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) {
37 37
                             continue;
38 38
                         }
39 39
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
                 },
46 46
             ],
47 47
             NodeKind::DIRECTIVE => [
48
-                'leave' => static function (DirectiveNode $directiveNode) use ($context) {
48
+                'leave' => static function(DirectiveNode $directiveNode) use ($context) {
49 49
                     $directiveDef = $context->getDirective();
50
-                    if (! $directiveDef) {
50
+                    if (!$directiveDef) {
51 51
                         return Visitor::skipNode();
52 52
                     }
53 53
                     $argNodes   = $directiveNode->arguments ?: [];
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
                     foreach ($directiveDef->args as $argDef) {
60 60
                         $argNode = $argNodeMap[$argDef->name] ?? null;
61
-                        if ($argNode || (! ($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) {
61
+                        if ($argNode || (!($argDef->getType() instanceof NonNull)) || $argDef->defaultValueExists()) {
62 62
                             continue;
63 63
                         }
64 64
 
Please login to merge, or discard this patch.
src/Validator/Rules/VariablesAreInputTypes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
     public function getVisitor(ValidationContext $context)
19 19
     {
20 20
         return [
21
-            NodeKind::VARIABLE_DEFINITION => static function (VariableDefinitionNode $node) use ($context) {
21
+            NodeKind::VARIABLE_DEFINITION => static function(VariableDefinitionNode $node) use ($context) {
22 22
                 $type = TypeInfo::typeFromAST($context->getSchema(), $node->type);
23 23
 
24 24
                 // If the variable type is not an input type, return an error.
25
-                if (! $type || Type::isInputType($type)) {
25
+                if (!$type || Type::isInputType($type)) {
26 26
                     return;
27 27
                 }
28 28
 
Please login to merge, or discard this patch.
src/Validator/DocumentValidator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public static function allRules()
126 126
     {
127
-        if (! self::$initRules) {
127
+        if (!self::$initRules) {
128 128
             static::$rules     = array_merge(static::defaultRules(), self::securityRules(), self::$rules);
129 129
             static::$initRules = true;
130 130
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         return is_array($value)
265 265
             ? count(array_filter(
266 266
                 $value,
267
-                static function ($item) {
267
+                static function($item) {
268 268
                     return $item instanceof Throwable;
269 269
                 }
270 270
             )) === count($value)
Please login to merge, or discard this patch.
src/Validator/ValidationContext.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
                 Visitor::visitWithTypeInfo(
106 106
                     $typeInfo,
107 107
                     [
108
-                        NodeKind::VARIABLE_DEFINITION => static function () {
108
+                        NodeKind::VARIABLE_DEFINITION => static function() {
109 109
                             return false;
110 110
                         },
111
-                        NodeKind::VARIABLE            => static function (VariableNode $variable) use (
111
+                        NodeKind::VARIABLE            => static function(VariableNode $variable) use (
112 112
                             &$newUsages,
113 113
                             $typeInfo
114 114
                         ) {
@@ -139,19 +139,19 @@  discard block
 block discarded – undo
139 139
             $fragments      = [];
140 140
             $collectedNames = [];
141 141
             $nodesToVisit   = [$operation];
142
-            while (! empty($nodesToVisit)) {
142
+            while (!empty($nodesToVisit)) {
143 143
                 $node    = array_pop($nodesToVisit);
144 144
                 $spreads = $this->getFragmentSpreads($node);
145 145
                 foreach ($spreads as $spread) {
146 146
                     $fragName = $spread->name->value;
147 147
 
148
-                    if (! empty($collectedNames[$fragName])) {
148
+                    if (!empty($collectedNames[$fragName])) {
149 149
                         continue;
150 150
                     }
151 151
 
152 152
                     $collectedNames[$fragName] = true;
153 153
                     $fragment                  = $this->getFragment($fragName);
154
-                    if (! $fragment) {
154
+                    if (!$fragment) {
155 155
                         continue;
156 156
                     }
157 157
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $spreads = [];
178 178
             /** @var SelectionSetNode[] $setsToVisit */
179 179
             $setsToVisit = [$node->selectionSet];
180
-            while (! empty($setsToVisit)) {
180
+            while (!empty($setsToVisit)) {
181 181
                 $set = array_pop($setsToVisit);
182 182
 
183 183
                 for ($i = 0, $selectionCount = count($set->selections); $i < $selectionCount; $i++) {
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
     public function getFragment($name)
208 208
     {
209 209
         $fragments = $this->fragments;
210
-        if (! $fragments) {
210
+        if (!$fragments) {
211 211
             $fragments = [];
212 212
             foreach ($this->getDocument()->definitions as $statement) {
213
-                if (! ($statement instanceof FragmentDefinitionNode)) {
213
+                if (!($statement instanceof FragmentDefinitionNode)) {
214 214
                     continue;
215 215
                 }
216 216
 
Please login to merge, or discard this patch.