Passed
Pull Request — master (#190)
by Sebastian
03:03
created
src/Type/definition.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 function assertType($type)
60 60
 {
61 61
     invariant(
62
-      $type instanceof TypeInterface,
63
-      \sprintf('Expected %s to be a GraphQL type.', (string)$type)
62
+        $type instanceof TypeInterface,
63
+        \sprintf('Expected %s to be a GraphQL type.', (string)$type)
64 64
     );
65 65
 }
66 66
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 function assertScalarType(TypeInterface $type)
73 73
 {
74 74
     invariant(
75
-      $type instanceof ScalarType,
76
-      \sprintf('Expected %s to be a GraphQL Scalar type.', (string)$type)
75
+        $type instanceof ScalarType,
76
+        \sprintf('Expected %s to be a GraphQL Scalar type.', (string)$type)
77 77
     );
78 78
 }
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 function assertObjectType(TypeInterface $type)
86 86
 {
87 87
     invariant(
88
-      $type instanceof ObjectType,
89
-      \sprintf('Expected %s to be a GraphQL Object type.', (string)$type)
88
+        $type instanceof ObjectType,
89
+        \sprintf('Expected %s to be a GraphQL Object type.', (string)$type)
90 90
     );
91 91
 }
92 92
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 function assertInterfaceType(TypeInterface $type)
99 99
 {
100 100
     invariant(
101
-      $type instanceof InterfaceType,
102
-      \sprintf('Expected %s to be a GraphQL Interface type.', (string)$type)
101
+        $type instanceof InterfaceType,
102
+        \sprintf('Expected %s to be a GraphQL Interface type.', (string)$type)
103 103
     );
104 104
 }
105 105
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 function assertUnionType(TypeInterface $type)
112 112
 {
113 113
     invariant(
114
-      $type instanceof UnionType,
115
-      \sprintf('Expected %s to be a GraphQL Union type.', (string)$type)
114
+        $type instanceof UnionType,
115
+        \sprintf('Expected %s to be a GraphQL Union type.', (string)$type)
116 116
     );
117 117
 }
118 118
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 function assertEnumType(TypeInterface $type)
125 125
 {
126 126
     invariant(
127
-      $type instanceof EnumType,
128
-      \sprintf('Expected %s to be a GraphQL Enum type.', (string)$type)
127
+        $type instanceof EnumType,
128
+        \sprintf('Expected %s to be a GraphQL Enum type.', (string)$type)
129 129
     );
130 130
 }
131 131
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 function assertInputObjectType(TypeInterface $type)
138 138
 {
139 139
     invariant(
140
-      $type instanceof InputObjectType,
141
-      \sprintf('Expected %s to be a GraphQL InputObject type.', (string)$type)
140
+        $type instanceof InputObjectType,
141
+        \sprintf('Expected %s to be a GraphQL InputObject type.', (string)$type)
142 142
     );
143 143
 }
144 144
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 function assertListType(TypeInterface $type)
151 151
 {
152 152
     invariant(
153
-      $type instanceof ListType,
154
-      \sprintf('Expected %s to be a GraphQL List type.', (string)$type)
153
+        $type instanceof ListType,
154
+        \sprintf('Expected %s to be a GraphQL List type.', (string)$type)
155 155
     );
156 156
 }
157 157
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 function assertNonNullType(TypeInterface $type)
164 164
 {
165 165
     invariant(
166
-      $type instanceof NonNullType,
167
-      \sprintf('Expected %s to be a GraphQL NonNull type.', (string)$type)
166
+        $type instanceof NonNullType,
167
+        \sprintf('Expected %s to be a GraphQL NonNull type.', (string)$type)
168 168
     );
169 169
 }
170 170
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 function assertInputType(TypeInterface $type)
191 191
 {
192 192
     invariant(
193
-      isInputType($type),
194
-      \sprintf('Expected %s to be a GraphQL input type.', (string)$type)
193
+        isInputType($type),
194
+        \sprintf('Expected %s to be a GraphQL input type.', (string)$type)
195 195
     );
196 196
 }
197 197
 
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 function assertOutputType(TypeInterface $type)
218 218
 {
219 219
     invariant(
220
-      isOutputType($type),
221
-      \sprintf('Expected %s to be a GraphQL output type.', (string)$type)
220
+        isOutputType($type),
221
+        \sprintf('Expected %s to be a GraphQL output type.', (string)$type)
222 222
     );
223 223
 }
224 224
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 function assertLeafType(TypeInterface $type)
231 231
 {
232 232
     invariant(
233
-      $type instanceof LeafTypeInterface,
234
-      \sprintf('Expected %s to be a GraphQL leaf type.', (string)$type)
233
+        $type instanceof LeafTypeInterface,
234
+        \sprintf('Expected %s to be a GraphQL leaf type.', (string)$type)
235 235
     );
236 236
 }
237 237
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 function assertCompositeType(TypeInterface $type)
244 244
 {
245 245
     invariant(
246
-      $type instanceof CompositeTypeInterface,
247
-      \sprintf('Expected %s to be a GraphQL composite type.', (string)$type)
246
+        $type instanceof CompositeTypeInterface,
247
+        \sprintf('Expected %s to be a GraphQL composite type.', (string)$type)
248 248
     );
249 249
 }
250 250
 
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 function assertAbstractType(TypeInterface $type)
257 257
 {
258 258
     invariant(
259
-      $type instanceof AbstractTypeInterface,
260
-      \sprintf('Expected %s to be a GraphQL abstract type.', (string)$type)
259
+        $type instanceof AbstractTypeInterface,
260
+        \sprintf('Expected %s to be a GraphQL abstract type.', (string)$type)
261 261
     );
262 262
 }
263 263
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 function assertWrappingType(TypeInterface $type)
270 270
 {
271 271
     invariant(
272
-      $type instanceof WrappingTypeInterface,
273
-      \sprintf('Expected %s to be a GraphQL wrapping type.', (string)$type)
272
+        $type instanceof WrappingTypeInterface,
273
+        \sprintf('Expected %s to be a GraphQL wrapping type.', (string)$type)
274 274
     );
275 275
 }
276 276
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 function assertNullableType(TypeInterface $type): TypeInterface
294 294
 {
295 295
     invariant(
296
-      isNullableType($type),
297
-      \sprintf('Expected %s to be a GraphQL nullable type.', (string)$type)
296
+        isNullableType($type),
297
+        \sprintf('Expected %s to be a GraphQL nullable type.', (string)$type)
298 298
     );
299 299
 
300 300
     return $type;
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 function assertNamedType(TypeInterface $type)
323 323
 {
324 324
     invariant(
325
-      $type instanceof NamedTypeInterface,
326
-      \sprintf('Expected %s to be a GraphQL named type.', (string)$type)
325
+        $type instanceof NamedTypeInterface,
326
+        \sprintf('Expected %s to be a GraphQL named type.', (string)$type)
327 327
     );
328 328
 }
329 329
 
Please login to merge, or discard this patch.
src/Type/directives.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 function specifiedDirectives(): array
38 38
 {
39 39
     return [
40
-      IncludeDirective(),
41
-      SkipDirective(),
42
-      DeprecatedDirective(),
40
+        IncludeDirective(),
41
+        SkipDirective(),
42
+        DeprecatedDirective(),
43 43
     ];
44 44
 }
45 45
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 function isSpecifiedDirective(DirectiveInterface $directive): bool
52 52
 {
53 53
     return arraySome(
54
-      specifiedDirectives(),
55
-      function (DirectiveInterface $specifiedDirective) use ($directive) {
56
-          return $specifiedDirective->getName() === $directive->getName();
57
-      }
54
+        specifiedDirectives(),
55
+        function (DirectiveInterface $specifiedDirective) use ($directive) {
56
+            return $specifiedDirective->getName() === $directive->getName();
57
+        }
58 58
     );
59 59
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 {
53 53
     return arraySome(
54 54
       specifiedDirectives(),
55
-      function (DirectiveInterface $specifiedDirective) use ($directive) {
55
+      function(DirectiveInterface $specifiedDirective) use ($directive) {
56 56
           return $specifiedDirective->getName() === $directive->getName();
57 57
       }
58 58
     );
Please login to merge, or discard this patch.
src/Type/DirectivesProvider.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
      * @var array
14 14
      */
15 15
     protected $provides = [
16
-      GraphQL::INCLUDE_DIRECTIVE,
17
-      GraphQL::SKIP_DIRECTIVE,
18
-      GraphQL::DEPRECATED_DIRECTIVE,
16
+        GraphQL::INCLUDE_DIRECTIVE,
17
+        GraphQL::SKIP_DIRECTIVE,
18
+        GraphQL::DEPRECATED_DIRECTIVE,
19 19
     ];
20 20
 
21 21
     /**
@@ -25,62 +25,62 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function () {
27 27
             return newDirective([
28
-              'name' => 'include',
29
-              'description' =>
28
+                'name' => 'include',
29
+                'description' =>
30 30
                 'Directs the executor to include this field or fragment only when ' .
31 31
                 'the `if` argument is true.',
32
-              'locations' => [
32
+                'locations' => [
33 33
                 DirectiveLocationEnum::FIELD,
34 34
                 DirectiveLocationEnum::FRAGMENT_SPREAD,
35 35
                 DirectiveLocationEnum::INLINE_FRAGMENT,
36
-              ],
37
-              'args' => [
36
+                ],
37
+                'args' => [
38 38
                 'if' => [
39
-                  'type' => newNonNull(Boolean()),
40
-                  'description' => 'Included when true.',
39
+                    'type' => newNonNull(Boolean()),
40
+                    'description' => 'Included when true.',
41
+                ],
41 42
                 ],
42
-              ],
43 43
             ]);
44 44
         }, true/* $shared */);
45 45
 
46 46
         $this->container->add(GraphQL::SKIP_DIRECTIVE, function () {
47 47
             return newDirective([
48
-              'name' => 'skip',
49
-              'description' =>
48
+                'name' => 'skip',
49
+                'description' =>
50 50
                 'Directs the executor to skip this field or fragment when the `if` ' .
51 51
                 'argument is true.',
52
-              'locations' => [
52
+                'locations' => [
53 53
                 DirectiveLocationEnum::FIELD,
54 54
                 DirectiveLocationEnum::FRAGMENT_SPREAD,
55 55
                 DirectiveLocationEnum::INLINE_FRAGMENT,
56
-              ],
57
-              'args' => [
56
+                ],
57
+                'args' => [
58 58
                 'if' => [
59
-                  'type' => newNonNull(Boolean()),
60
-                  'description' => 'Skipped when true.',
59
+                    'type' => newNonNull(Boolean()),
60
+                    'description' => 'Skipped when true.',
61
+                ],
61 62
                 ],
62
-              ],
63 63
             ]);
64 64
         }, true/* $shared */);
65 65
 
66 66
         $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function () {
67 67
             return newDirective([
68
-              'name' => 'deprecated',
69
-              'description' => 'Marks an element of a GraphQL schema as no longer supported.',
70
-              'locations' => [
68
+                'name' => 'deprecated',
69
+                'description' => 'Marks an element of a GraphQL schema as no longer supported.',
70
+                'locations' => [
71 71
                 DirectiveLocationEnum::FIELD_DEFINITION,
72 72
                 DirectiveLocationEnum::ENUM_VALUE,
73
-              ],
74
-              'args' => [
73
+                ],
74
+                'args' => [
75 75
                 'reason' => [
76
-                  'type' => String(),
77
-                  'description' =>
76
+                    'type' => String(),
77
+                    'description' =>
78 78
                     'Explains why this element was deprecated, usually also including a ' .
79 79
                     'suggestion for how to access supported similar data. Formatted ' .
80 80
                     'in [Markdown](https://daringfireball.net/projects/markdown/).',
81
-                  'defaultValue' => DEFAULT_DEPRECATION_REASON,
81
+                    'defaultValue' => DEFAULT_DEPRECATION_REASON,
82
+                ],
82 83
                 ],
83
-              ],
84 84
             ]);
85 85
         }, true/* $shared */);
86 86
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function register()
25 25
     {
26
-        $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function () {
26
+        $this->container->add(GraphQL::INCLUDE_DIRECTIVE, function() {
27 27
             return newDirective([
28 28
               'name' => 'include',
29 29
               'description' =>
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             ]);
44 44
         }, true/* $shared */);
45 45
 
46
-        $this->container->add(GraphQL::SKIP_DIRECTIVE, function () {
46
+        $this->container->add(GraphQL::SKIP_DIRECTIVE, function() {
47 47
             return newDirective([
48 48
               'name' => 'skip',
49 49
               'description' =>
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             ]);
64 64
         }, true/* $shared */);
65 65
 
66
-        $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function () {
66
+        $this->container->add(GraphQL::DEPRECATED_DIRECTIVE, function() {
67 67
             return newDirective([
68 68
               'name' => 'deprecated',
69 69
               'description' => 'Marks an element of a GraphQL schema as no longer supported.',
Please login to merge, or discard this patch.
src/Type/Definition/ArgumentsTrait.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
     protected function setArgs(array $arguments)
44 44
     {
45 45
         invariant(
46
-          isAssocArray($arguments),
47
-          'Args must be an associative array with argument names as keys.'
46
+            isAssocArray($arguments),
47
+            'Args must be an associative array with argument names as keys.'
48 48
         );
49 49
 
50 50
         foreach ($arguments as $argumentName => $argument) {
Please login to merge, or discard this patch.
src/Type/Definition/UnionType.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  *     ]);
34 34
  */
35 35
 class UnionType implements AbstractTypeInterface, NamedTypeInterface, CompositeTypeInterface, OutputTypeInterface,
36
-  ConfigAwareInterface, NodeAwareInterface
36
+    ConfigAwareInterface, NodeAwareInterface
37 37
 {
38 38
 
39 39
     use ConfigAwareTrait;
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
         $typeMap = resolveThunk($typesOrThunk);
77 77
 
78 78
         invariant(
79
-          \is_array($typeMap),
80
-          \sprintf(
79
+            \is_array($typeMap),
80
+            \sprintf(
81 81
             'Must provide Array of types or a function which returns such an array for Union %s.',
82 82
             $this->getName()
83
-          )
83
+            )
84 84
         );
85 85
 
86 86
         return $typeMap;
Please login to merge, or discard this patch.
src/Type/Definition/InterfaceType.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
  *     ]);
26 26
  */
27 27
 class InterfaceType implements NamedTypeInterface, AbstractTypeInterface, CompositeTypeInterface,
28
-  OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
28
+    OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
29 29
 {
30 30
 
31 31
     use ConfigAwareTrait;
Please login to merge, or discard this patch.
src/Type/Definition/EnumType.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  * will be used as its internal value.
36 36
  */
37 37
 class EnumType implements TypeInterface, NamedTypeInterface, InputTypeInterface,
38
-  LeafTypeInterface, OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
38
+    LeafTypeInterface, OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
39 39
 {
40 40
 
41 41
     use ConfigAwareTrait;
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
     protected function buildValues(array $valueMap): array
120 120
     {
121 121
         invariant(
122
-          isAssocArray($valueMap),
123
-          \sprintf('%s values must be an associative array with value names as keys.',
122
+            isAssocArray($valueMap),
123
+            \sprintf('%s values must be an associative array with value names as keys.',
124 124
             $this->getName())
125 125
         );
126 126
 
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
 
129 129
         foreach ($valueMap as $valueName => $valueConfig) {
130 130
             invariant(
131
-              isAssocArray($valueConfig),
132
-              \sprintf(
131
+                isAssocArray($valueConfig),
132
+                \sprintf(
133 133
                 '%s.%s must refer to an object with a "value" key representing an internal value but got: %s',
134 134
                 $this->getName(),
135 135
                 $valueName,
136 136
                 toString($valueConfig)
137
-              )
137
+                )
138 138
             );
139 139
 
140 140
             invariant(
141
-              !isset($valueConfig['isDeprecated']),
142
-              \sprintf(
141
+                !isset($valueConfig['isDeprecated']),
142
+                \sprintf(
143 143
                 '%s.%s should provided "deprecationReason" instead of "isDeprecated".',
144 144
                 $this->getName(),
145 145
                 $valueName
146
-              )
146
+                )
147 147
             );
148 148
 
149 149
             $values[] = new EnumValue(\array_merge($valueConfig,
150
-              ['name' => $valueName]));
150
+                ['name' => $valueName]));
151 151
         }
152 152
 
153 153
         return $values;
Please login to merge, or discard this patch.
src/Type/Definition/ObjectType.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  *     ]);
51 51
  */
52 52
 class ObjectType implements TypeInterface, NamedTypeInterface, CompositeTypeInterface, OutputTypeInterface,
53
-  ConfigAwareInterface, NodeAwareInterface
53
+    ConfigAwareInterface, NodeAwareInterface
54 54
 {
55 55
 
56 56
     use ConfigAwareTrait;
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
         $interfaces = resolveThunk($interfacesOrThunk);
129 129
 
130 130
         invariant(
131
-          \is_array($interfaces),
132
-          \sprintf('%s interfaces must be an array or a function which returns an array.',
131
+            \is_array($interfaces),
132
+            \sprintf('%s interfaces must be an array or a function which returns an array.',
133 133
             $this->getName())
134 134
         );
135 135
 
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
         if ($this->getIsTypeOf() !== null) {
147 147
             invariant(
148
-              \is_callable($this->getIsTypeOf()),
149
-              \sprintf('%s must provide "isTypeOf" as a function.',
148
+                \is_callable($this->getIsTypeOf()),
149
+                \sprintf('%s must provide "isTypeOf" as a function.',
150 150
                 $this->getName())
151 151
             );
152 152
         }
Please login to merge, or discard this patch.
src/Type/Definition/FieldsTrait.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -70,40 +70,40 @@
 block discarded – undo
70 70
         $fields = resolveThunk($fieldsOrThunk);
71 71
 
72 72
         invariant(
73
-          isAssocArray($fields),
74
-          \sprintf(
73
+            isAssocArray($fields),
74
+            \sprintf(
75 75
             '%s fields must be an associative array with field names as key or a callable which returns such an array.',
76 76
             $this->getName()
77
-          )
77
+            )
78 78
         );
79 79
 
80 80
         $fieldMap = [];
81 81
 
82 82
         foreach ($fields as $fieldName => $fieldConfig) {
83 83
             invariant(
84
-              \is_array($fieldConfig),
85
-              \sprintf('%s.%s field config must be an array', $this->getName(),
84
+                \is_array($fieldConfig),
85
+                \sprintf('%s.%s field config must be an array', $this->getName(),
86 86
                 $fieldName)
87 87
             );
88 88
 
89 89
             invariant(
90
-              !isset($fieldConfig['isDeprecated']),
91
-              \sprintf(
90
+                !isset($fieldConfig['isDeprecated']),
91
+                \sprintf(
92 92
                 '%s.%s should provide "deprecationReason" instead of "isDeprecated".',
93 93
                 $this->getName(),
94 94
                 $fieldName
95
-              )
95
+                )
96 96
             );
97 97
 
98 98
             if (isset($fieldConfig['resolve'])) {
99 99
                 invariant(
100
-                  null === $fieldConfig['resolve'] || \is_callable($fieldConfig['resolve']),
101
-                  \sprintf(
100
+                    null === $fieldConfig['resolve'] || \is_callable($fieldConfig['resolve']),
101
+                    \sprintf(
102 102
                     '%s.%s field resolver must be a function if provided, but got: %s',
103 103
                     $this->getName(),
104 104
                     $fieldName,
105 105
                     toString($fieldConfig['resolve'])
106
-                  )
106
+                    )
107 107
                 );
108 108
             }
109 109
 
Please login to merge, or discard this patch.