Passed
Pull Request — master (#190)
by Sebastian
03:03
created
src/Validation/ValidationProvider.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      * @var array
13 13
      */
14 14
     protected $provides = [
15
-      ValidatorInterface::class,
15
+        ValidatorInterface::class,
16 16
     ];
17 17
 
18 18
     /**
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function register()
22 22
     {
23 23
         $this->container->add(ValidatorInterface::class, Validator::class,
24
-          true/* $shared */)
25
-          ->withArgument(SchemaValidatorInterface::class);
24
+            true/* $shared */)
25
+            ->withArgument(SchemaValidatorInterface::class);
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/Validation/RulesProvider.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -38,31 +38,31 @@  discard block
 block discarded – undo
38 38
      * @var array
39 39
      */
40 40
     protected $provides = [
41
-      ExecutableDefinitionsRule::class,
42
-      FieldOnCorrectTypeRule::class,
43
-      FragmentsOnCompositeTypesRule::class,
44
-      KnownArgumentNamesRule::class,
45
-      KnownDirectivesRule::class,
46
-      KnownFragmentNamesRule::class,
47
-      KnownTypeNamesRule::class,
48
-      LoneAnonymousOperationRule::class,
49
-      NoFragmentCyclesRule::class,
50
-      NoUndefinedVariablesRule::class,
51
-      NoUnusedFragmentsRule::class,
52
-      NoUnusedVariablesRule::class,
53
-      OverlappingFieldsCanBeMergedRule::class,
54
-      PossibleFragmentSpreadsRule::class,
55
-      ProvidedNonNullArgumentsRule::class,
56
-      ScalarLeafsRule::class,
57
-      SingleFieldSubscriptionsRule::class,
58
-      UniqueArgumentNamesRule::class,
59
-      UniqueDirectivesPerLocationRule::class,
60
-      UniqueFragmentNamesRule::class,
61
-      UniqueVariableNamesRule::class,
62
-      ValuesOfCorrectTypeRule::class,
63
-      VariablesAreInputTypesRule::class,
64
-      VariablesDefaultValueAllowedRule::class,
65
-      VariablesInAllowedPositionRule::class,
41
+        ExecutableDefinitionsRule::class,
42
+        FieldOnCorrectTypeRule::class,
43
+        FragmentsOnCompositeTypesRule::class,
44
+        KnownArgumentNamesRule::class,
45
+        KnownDirectivesRule::class,
46
+        KnownFragmentNamesRule::class,
47
+        KnownTypeNamesRule::class,
48
+        LoneAnonymousOperationRule::class,
49
+        NoFragmentCyclesRule::class,
50
+        NoUndefinedVariablesRule::class,
51
+        NoUnusedFragmentsRule::class,
52
+        NoUnusedVariablesRule::class,
53
+        OverlappingFieldsCanBeMergedRule::class,
54
+        PossibleFragmentSpreadsRule::class,
55
+        ProvidedNonNullArgumentsRule::class,
56
+        ScalarLeafsRule::class,
57
+        SingleFieldSubscriptionsRule::class,
58
+        UniqueArgumentNamesRule::class,
59
+        UniqueDirectivesPerLocationRule::class,
60
+        UniqueFragmentNamesRule::class,
61
+        UniqueVariableNamesRule::class,
62
+        ValuesOfCorrectTypeRule::class,
63
+        VariablesAreInputTypesRule::class,
64
+        VariablesDefaultValueAllowedRule::class,
65
+        VariablesInAllowedPositionRule::class,
66 66
     ];
67 67
 
68 68
     /**
@@ -71,57 +71,57 @@  discard block
 block discarded – undo
71 71
     public function register()
72 72
     {
73 73
         $this->container->add(ExecutableDefinitionsRule::class,
74
-          ExecutableDefinitionsRule::class);
74
+            ExecutableDefinitionsRule::class);
75 75
         $this->container->add(FieldOnCorrectTypeRule::class,
76
-          FieldOnCorrectTypeRule::class);
76
+            FieldOnCorrectTypeRule::class);
77 77
         $this->container->add(FragmentsOnCompositeTypesRule::class,
78
-          FragmentsOnCompositeTypesRule::class);
78
+            FragmentsOnCompositeTypesRule::class);
79 79
         $this->container->add(KnownArgumentNamesRule::class,
80
-          KnownArgumentNamesRule::class);
80
+            KnownArgumentNamesRule::class);
81 81
         $this->container->add(KnownDirectivesRule::class,
82
-          KnownDirectivesRule::class);
82
+            KnownDirectivesRule::class);
83 83
         $this->container->add(KnownFragmentNamesRule::class,
84
-          KnownFragmentNamesRule::class);
84
+            KnownFragmentNamesRule::class);
85 85
         $this->container->add(KnownTypeNamesRule::class,
86
-          KnownTypeNamesRule::class);
86
+            KnownTypeNamesRule::class);
87 87
         $this->container->add(LoneAnonymousOperationRule::class,
88
-          LoneAnonymousOperationRule::class);
88
+            LoneAnonymousOperationRule::class);
89 89
         $this->container->add(NoFragmentCyclesRule::class,
90
-          NoFragmentCyclesRule::class);
90
+            NoFragmentCyclesRule::class);
91 91
         $this->container->add(NoUndefinedVariablesRule::class,
92
-          NoUndefinedVariablesRule::class);
92
+            NoUndefinedVariablesRule::class);
93 93
         $this->container->add(NoUnusedFragmentsRule::class,
94
-          NoUnusedFragmentsRule::class);
94
+            NoUnusedFragmentsRule::class);
95 95
         $this->container->add(NoUnusedVariablesRule::class,
96
-          NoUnusedVariablesRule::class);
96
+            NoUnusedVariablesRule::class);
97 97
         $this->container->add(OverlappingFieldsCanBeMergedRule::class,
98
-          OverlappingFieldsCanBeMergedRule::class);
98
+            OverlappingFieldsCanBeMergedRule::class);
99 99
         $this->container->add(PossibleFragmentSpreadsRule::class,
100
-          PossibleFragmentSpreadsRule::class);
100
+            PossibleFragmentSpreadsRule::class);
101 101
         $this->container->add(ProvidedNonNullArgumentsRule::class,
102
-          ProvidedNonNullArgumentsRule::class);
102
+            ProvidedNonNullArgumentsRule::class);
103 103
         $this->container->add(ScalarLeafsRule::class, ScalarLeafsRule::class);
104 104
         $this->container->add(SingleFieldSubscriptionsRule::class,
105
-          SingleFieldSubscriptionsRule::class);
105
+            SingleFieldSubscriptionsRule::class);
106 106
         $this->container->add(UniqueArgumentNamesRule::class,
107
-          UniqueArgumentNamesRule::class);
107
+            UniqueArgumentNamesRule::class);
108 108
         $this->container->add(UniqueDirectivesPerLocationRule::class,
109
-          UniqueDirectivesPerLocationRule::class);
109
+            UniqueDirectivesPerLocationRule::class);
110 110
         $this->container->add(UniqueFragmentNamesRule::class,
111
-          UniqueFragmentNamesRule::class);
111
+            UniqueFragmentNamesRule::class);
112 112
         $this->container->add(UniqueInputFieldNamesRule::class,
113
-          UniqueInputFieldNamesRule::class);
113
+            UniqueInputFieldNamesRule::class);
114 114
         $this->container->add(UniqueOperationNamesRule::class,
115
-          UniqueOperationNamesRule::class);
115
+            UniqueOperationNamesRule::class);
116 116
         $this->container->add(UniqueVariableNamesRule::class,
117
-          UniqueVariableNamesRule::class);
117
+            UniqueVariableNamesRule::class);
118 118
         $this->container->add(ValuesOfCorrectTypeRule::class,
119
-          ValuesOfCorrectTypeRule::class);
119
+            ValuesOfCorrectTypeRule::class);
120 120
         $this->container->add(VariablesAreInputTypesRule::class,
121
-          VariablesAreInputTypesRule::class);
121
+            VariablesAreInputTypesRule::class);
122 122
         $this->container->add(VariablesDefaultValueAllowedRule::class,
123
-          VariablesDefaultValueAllowedRule::class);
123
+            VariablesDefaultValueAllowedRule::class);
124 124
         $this->container->add(VariablesInAllowedPositionRule::class,
125
-          VariablesInAllowedPositionRule::class);
125
+            VariablesInAllowedPositionRule::class);
126 126
     }
127 127
 }
Please login to merge, or discard this patch.
src/Validation/ValidationContextInterface.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @return array
88 88
      */
89 89
     public function getRecursiveVariableUsages(
90
-      OperationDefinitionNode $operation
90
+        OperationDefinitionNode $operation
91 91
     ): array;
92 92
 
93 93
     /**
@@ -103,6 +103,6 @@  discard block
 block discarded – undo
103 103
      * @return array|FragmentDefinitionNode[]
104 104
      */
105 105
     public function getRecursivelyReferencedFragments(
106
-      OperationDefinitionNode $operation
106
+        OperationDefinitionNode $operation
107 107
     ): array;
108 108
 }
Please login to merge, or discard this patch.
src/Validation/comparators.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 function compareArguments(array $argumentsA, array $argumentsB): bool
17 17
 {
18 18
     return GraphQL::make(ValueHelper::class)
19
-      ->compareArguments($argumentsA, $argumentsB);
19
+        ->compareArguments($argumentsA, $argumentsB);
20 20
 }
21 21
 
22 22
 /**
Please login to merge, or discard this patch.
src/Validation/ValidationContext.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      * @param TypeInfo $typeInfo
78 78
      */
79 79
     public function __construct(
80
-      SchemaInterface $schema,
81
-      DocumentNode $document,
82
-      TypeInfo $typeInfo
80
+        SchemaInterface $schema,
81
+        DocumentNode $document,
82
+        TypeInfo $typeInfo
83 83
     ) {
84 84
         $this->schema = $schema;
85 85
         $this->document = $document;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      * @inheritdoc
171 171
      */
172 172
     public function getRecursiveVariableUsages(
173
-      OperationDefinitionNode $operation
173
+        OperationDefinitionNode $operation
174 174
     ): array {
175 175
         $usages = $this->recursiveVariableUsages[(string)$operation] ?? null;
176 176
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                 // TODO: Figure out a more performance way to do this.
183 183
                 /** @noinspection SlowArrayOperationsInLoopInspection */
184 184
                 $usages = array_merge($usages,
185
-                  $this->getVariableUsages($fragment));
185
+                    $this->getVariableUsages($fragment));
186 186
             }
187 187
 
188 188
             $this->recursiveVariableUsages[(string)$operation] = $usages;
@@ -204,23 +204,23 @@  discard block
 block discarded – undo
204 204
             $usages = [];
205 205
             $typeInfo = new TypeInfo($this->schema);
206 206
             $visitor = new TypeInfoVisitor($typeInfo, new Visitor(
207
-              function (NodeInterface $node) use (
207
+                function (NodeInterface $node) use (
208 208
                 &$usages,
209 209
                 $typeInfo
210
-              ): ?NodeInterface {
211
-                  if ($node instanceof VariableDefinitionNode) {
212
-                      return null;
213
-                  }
210
+                ): ?NodeInterface {
211
+                    if ($node instanceof VariableDefinitionNode) {
212
+                        return null;
213
+                    }
214 214
 
215
-                  if ($node instanceof VariableNode) {
216
-                      $usages[] = [
215
+                    if ($node instanceof VariableNode) {
216
+                        $usages[] = [
217 217
                         'node' => $node,
218 218
                         'type' => $typeInfo->getInputType(),
219
-                      ];
220
-                  }
219
+                        ];
220
+                    }
221 221
 
222
-                  return $node;
223
-              }
222
+                    return $node;
223
+                }
224 224
             ));
225 225
 
226 226
             $node->acceptVisitor($visitor);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @inheritdoc
236 236
      */
237 237
     public function getRecursivelyReferencedFragments(
238
-      OperationDefinitionNode $operation
238
+        OperationDefinitionNode $operation
239 239
     ): array {
240 240
         $fragments = $this->recursivelyReferencedFragment[(string)$operation] ?? null;
241 241
 
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
     {
309 309
         if (empty($this->fragments)) {
310 310
             $this->fragments = array_reduce($this->document->getDefinitions(),
311
-              function ($fragments, $definition) {
312
-                  if ($definition instanceof FragmentDefinitionNode) {
313
-                      $fragments[$definition->getNameValue()] = $definition;
314
-                  }
315
-                  return $fragments;
316
-              }, []);
311
+                function ($fragments, $definition) {
312
+                    if ($definition instanceof FragmentDefinitionNode) {
313
+                        $fragments[$definition->getNameValue()] = $definition;
314
+                    }
315
+                    return $fragments;
316
+                }, []);
317 317
         }
318 318
 
319 319
         return $this->fragments[$name] ?? null;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             $usages = [];
205 205
             $typeInfo = new TypeInfo($this->schema);
206 206
             $visitor = new TypeInfoVisitor($typeInfo, new Visitor(
207
-              function (NodeInterface $node) use (
207
+              function(NodeInterface $node) use (
208 208
                 &$usages,
209 209
                 $typeInfo
210 210
               ): ?NodeInterface {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     {
309 309
         if (empty($this->fragments)) {
310 310
             $this->fragments = array_reduce($this->document->getDefinitions(),
311
-              function ($fragments, $definition) {
311
+              function($fragments, $definition) {
312 312
                   if ($definition instanceof FragmentDefinitionNode) {
313 313
                       $fragments[$definition->getNameValue()] = $definition;
314 314
                   }
Please login to merge, or discard this patch.
src/Validation/ValidatorInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
      * @return ValidationException[]
20 20
      */
21 21
     public function validate(
22
-      SchemaInterface $schema,
23
-      DocumentNode $document,
22
+        SchemaInterface $schema,
23
+        DocumentNode $document,
24 24
       ?array $rules = null,
25 25
       ?TypeInfo $typeInfo = null
26 26
     ): array;
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
      * @return ValidationContextInterface
34 34
      */
35 35
     public function createContext(
36
-      SchemaInterface $schema,
37
-      DocumentNode $document,
38
-      TypeInfo $typeInfo
36
+        SchemaInterface $schema,
37
+        DocumentNode $document,
38
+        TypeInfo $typeInfo
39 39
     ): ValidationContextInterface;
40 40
 }
Please login to merge, or discard this patch.
src/Validation/Rule/FragmentsOnCompositeTypesRule.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
     ): ?NodeInterface
30 30
     {
31 31
         $this->validateFragementNode($node,
32
-          function (FragmentDefinitionNode $node) {
33
-              return fragmentOnNonCompositeMessage((string)$node,
32
+            function (FragmentDefinitionNode $node) {
33
+                return fragmentOnNonCompositeMessage((string)$node,
34 34
                 (string)$node->getTypeCondition());
35
-          });
35
+            });
36 36
 
37 37
         return $node;
38 38
     }
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
     ): ?NodeInterface
45 45
     {
46 46
         $this->validateFragementNode($node,
47
-          function (InlineFragmentNode $node) {
48
-              return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition());
49
-          });
47
+            function (InlineFragmentNode $node) {
48
+                return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition());
49
+            });
50 50
 
51 51
         return $node;
52 52
     }
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
      * @throws \TypeError
61 61
      */
62 62
     protected function validateFragementNode(
63
-      NodeInterface $node,
64
-      callable $errorMessageFunction
63
+        NodeInterface $node,
64
+        callable $errorMessageFunction
65 65
     ) {
66 66
         $typeCondition = $node->getTypeCondition();
67 67
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
             if (null !== $type && !($type instanceof CompositeTypeInterface)) {
72 72
                 $this->context->reportError(
73
-                  new ValidationException($errorMessageFunction($node),
73
+                    new ValidationException($errorMessageFunction($node),
74 74
                     [$typeCondition]
75
-                  )
75
+                    )
76 76
                 );
77 77
             }
78 78
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     ): ?NodeInterface
30 30
     {
31 31
         $this->validateFragementNode($node,
32
-          function (FragmentDefinitionNode $node) {
32
+          function(FragmentDefinitionNode $node) {
33 33
               return fragmentOnNonCompositeMessage((string)$node,
34 34
                 (string)$node->getTypeCondition());
35 35
           });
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     ): ?NodeInterface
45 45
     {
46 46
         $this->validateFragementNode($node,
47
-          function (InlineFragmentNode $node) {
47
+          function(InlineFragmentNode $node) {
48 48
               return inlineFragmentOnNonCompositeMessage((string)$node->getTypeCondition());
49 49
           });
50 50
 
Please login to merge, or discard this patch.
src/Validation/Rule/NoUnusedFragmentsRule.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
             if (!isset($fragmentNamesUsed[$fragmentName])) {
70 70
                 $this->context->reportError(
71
-                  new ValidationException(unusedFragmentMessage($fragmentName),
71
+                    new ValidationException(unusedFragmentMessage($fragmentName),
72 72
                     [$fragmentDefinition])
73 73
                 );
74 74
             }
Please login to merge, or discard this patch.
src/Validation/Rule/SingleFieldSubscriptionsRule.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
             $selections = $selectionSet->getSelections();
32 32
             if (\count($selections) !== 1) {
33 33
                 $this->context->reportError(
34
-                  new ValidationException(singleFieldOnlyMessage((string)$node),
34
+                    new ValidationException(singleFieldOnlyMessage((string)$node),
35 35
                     \array_slice($selections, 1))
36 36
                 );
37 37
             }
Please login to merge, or discard this patch.