Passed
Pull Request — master (#190)
by Sebastian
03:03
created
src/Type/Definition/NonNullType.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     {
34 34
         if ($ofType instanceof NonNullType) {
35 35
             throw new InvalidTypeException(\sprintf('Expected %s to be a GraphQL nullable type.',
36
-              (string)$ofType));
36
+                (string)$ofType));
37 37
         }
38 38
 
39 39
         $this->ofType = $ofType;
Please login to merge, or discard this patch.
src/Type/Definition/ScalarType.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use function Digia\GraphQL\Util\invariant;
11 11
 
12 12
 class ScalarType implements TypeInterface, NamedTypeInterface, LeafTypeInterface, InputTypeInterface,
13
-  OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
13
+    OutputTypeInterface, ConfigAwareInterface, NodeAwareInterface
14 14
 {
15 15
 
16 16
     use ConfigAwareTrait;
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
     protected function afterConfig(): void
95 95
     {
96 96
         invariant(
97
-          \is_callable($this->serializeFunction),
98
-          \sprintf(
97
+            \is_callable($this->serializeFunction),
98
+            \sprintf(
99 99
             '%s must provide "serialize" function. If this custom Scalar ' .
100 100
             'is also used as an input type, ensure "parseValue" and "parseLiteral" ' .
101 101
             'functions are also provided.',
102 102
             $this->getName()
103
-          )
103
+            )
104 104
         );
105 105
 
106 106
         if (null !== $this->parseValueFunction || null !== $this->parseLiteralFunction) {
107 107
             invariant(
108
-              \is_callable($this->parseValueFunction) && \is_callable($this->parseLiteralFunction),
109
-              \sprintf('%s must provide both "parseValue" and "parseLiteral" functions.',
108
+                \is_callable($this->parseValueFunction) && \is_callable($this->parseLiteralFunction),
109
+                \sprintf('%s must provide both "parseValue" and "parseLiteral" functions.',
110 110
                 $this->getName())
111 111
             );
112 112
         }
Please login to merge, or discard this patch.
src/Type/introspection.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 function introspectionTypes(): array
106 106
 {
107 107
     return [
108
-      __Schema(),
109
-      __Directive(),
110
-      __DirectiveLocation(),
111
-      __Type(),
112
-      __Field(),
113
-      __InputValue(),
114
-      __EnumValue(),
115
-      __TypeKind(),
108
+        __Schema(),
109
+        __Directive(),
110
+        __DirectiveLocation(),
111
+        __Type(),
112
+        __Field(),
113
+        __InputValue(),
114
+        __EnumValue(),
115
+        __TypeKind(),
116 116
     ];
117 117
 }
118 118
 
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 function isIntrospectionType(TypeInterface $type): bool
125 125
 {
126 126
     return arraySome(
127
-      introspectionTypes(),
128
-      function (TypeInterface $introspectionType) use ($type) {
129
-          /** @noinspection PhpUndefinedMethodInspection */
130
-          return $type->getName() === $introspectionType->getName();
131
-      }
127
+        introspectionTypes(),
128
+        function (TypeInterface $introspectionType) use ($type) {
129
+            /** @noinspection PhpUndefinedMethodInspection */
130
+            return $type->getName() === $introspectionType->getName();
131
+        }
132 132
     );
133 133
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@
 block discarded – undo
125 125
 {
126 126
     return arraySome(
127 127
       introspectionTypes(),
128
-      function (TypeInterface $introspectionType) use ($type) {
128
+      function(TypeInterface $introspectionType) use ($type) {
129 129
           /** @noinspection PhpUndefinedMethodInspection */
130 130
           return $type->getName() === $introspectionType->getName();
131 131
       }
Please login to merge, or discard this patch.
src/Type/scalars.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 function specifiedScalarTypes(): array
54 54
 {
55 55
     return [
56
-      String(),
57
-      Int(),
58
-      Float(),
59
-      Boolean(),
60
-      ID(),
56
+        String(),
57
+        Int(),
58
+        Float(),
59
+        Boolean(),
60
+        ID(),
61 61
     ];
62 62
 }
63 63
 
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 function isSpecifiedScalarType(TypeInterface $type): bool
70 70
 {
71 71
     return arraySome(
72
-      specifiedScalarTypes(),
73
-      function (ScalarType $specifiedScalarType) use ($type) {
74
-          /** @noinspection PhpUndefinedMethodInspection */
75
-          return $type->getName() === $specifiedScalarType->getName();
76
-      }
72
+        specifiedScalarTypes(),
73
+        function (ScalarType $specifiedScalarType) use ($type) {
74
+            /** @noinspection PhpUndefinedMethodInspection */
75
+            return $type->getName() === $specifiedScalarType->getName();
76
+        }
77 77
     );
78 78
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 {
71 71
     return arraySome(
72 72
       specifiedScalarTypes(),
73
-      function (ScalarType $specifiedScalarType) use ($type) {
73
+      function(ScalarType $specifiedScalarType) use ($type) {
74 74
           /** @noinspection PhpUndefinedMethodInspection */
75 75
           return $type->getName() === $specifiedScalarType->getName();
76 76
       }
Please login to merge, or discard this patch.
src/Type/Coercer/FloatCoercer.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,6 +21,6 @@
 block discarded – undo
21 21
         }
22 22
 
23 23
         throw new InvalidTypeException(\sprintf('Float cannot represent non numeric value: %s',
24
-          $value));
24
+            $value));
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
src/Type/Coercer/BooleanCoercer.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     {
15 15
         if (!\is_scalar($value)) {
16 16
             throw new InvalidTypeException(\sprintf('Boolean cannot represent a non-scalar value: %s',
17
-              $value));
17
+                $value));
18 18
         }
19 19
 
20 20
         return (bool)$value;
Please login to merge, or discard this patch.
src/Type/Coercer/IntCoercer.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
         if (!\is_int($value) || $value > PHP_INT_MAX || $value < PHP_INT_MIN) {
24 24
             throw new InvalidTypeException(
25
-              \sprintf('Int cannot represent non 32-bit signed integer value: %s',
25
+                \sprintf('Int cannot represent non 32-bit signed integer value: %s',
26 26
                 $value)
27 27
             );
28 28
         }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
         if ($floatValue != $intValue || \floor($floatValue) !== $floatValue) {
34 34
             throw new InvalidTypeException(\sprintf('Int cannot represent non-integer value: %s',
35
-              $value));
35
+                $value));
36 36
         }
37 37
 
38 38
         return $intValue;
Please login to merge, or discard this patch.
src/Type/ScalarTypesProvider.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
      * @var array
23 23
      */
24 24
     protected $provides = [
25
-      GraphQL::BOOLEAN,
26
-      GraphQL::FLOAT,
27
-      GraphQL::INT,
28
-      GraphQL::ID,
29
-      GraphQL::STRING,
25
+        GraphQL::BOOLEAN,
26
+        GraphQL::FLOAT,
27
+        GraphQL::INT,
28
+        GraphQL::ID,
29
+        GraphQL::STRING,
30 30
     ];
31 31
 
32 32
     /**
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
     public function register()
36 36
     {
37 37
         $this->container->add(GraphQL::BOOLEAN,
38
-          function (BooleanCoercer $coercer) {
39
-              return newScalarType([
38
+            function (BooleanCoercer $coercer) {
39
+                return newScalarType([
40 40
                 'name' => TypeNameEnum::BOOLEAN,
41 41
                 'description' => 'The `Boolean` scalar type represents `true` or `false`.',
42 42
                 'serialize' => function ($value) use ($coercer) {
@@ -51,92 +51,92 @@  discard block
 block discarded – undo
51 51
                     }
52 52
                     return null;
53 53
                 },
54
-              ]);
55
-          }, true/* $shared */)
56
-          ->withArgument(BooleanCoercer::class);
54
+                ]);
55
+            }, true/* $shared */)
56
+            ->withArgument(BooleanCoercer::class);
57 57
 
58 58
         $this->container->add(GraphQL::FLOAT, function (FloatCoercer $coercer) {
59 59
             return newScalarType([
60
-              'name' => TypeNameEnum::FLOAT,
61
-              'description' =>
60
+                'name' => TypeNameEnum::FLOAT,
61
+                'description' =>
62 62
                 'The `Float` scalar type represents signed double-precision fractional ' .
63 63
                 'values as specified by ' .
64 64
                 '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
65
-              'serialize' => function ($value) use ($coercer) {
66
-                  return $coercer->coerce($value);
67
-              },
68
-              'parseValue' => function ($value) use ($coercer) {
69
-                  return $coercer->coerce($value);
70
-              },
71
-              'parseLiteral' => function (NodeInterface $node) {
72
-                  if ($node instanceof FloatValueNode || $node instanceof IntValueNode) {
73
-                      return $node->getValue();
74
-                  }
75
-                  return null;
76
-              },
65
+                'serialize' => function ($value) use ($coercer) {
66
+                    return $coercer->coerce($value);
67
+                },
68
+                'parseValue' => function ($value) use ($coercer) {
69
+                    return $coercer->coerce($value);
70
+                },
71
+                'parseLiteral' => function (NodeInterface $node) {
72
+                    if ($node instanceof FloatValueNode || $node instanceof IntValueNode) {
73
+                        return $node->getValue();
74
+                    }
75
+                    return null;
76
+                },
77 77
             ]);
78 78
         }, true/* $shared */)
79
-          ->withArgument(FloatCoercer::class);
79
+            ->withArgument(FloatCoercer::class);
80 80
 
81 81
         $this->container->add(GraphQL::INT, function (IntCoercer $coercer) {
82 82
             return newScalarType([
83
-              'name' => TypeNameEnum::INT,
84
-              'description' =>
83
+                'name' => TypeNameEnum::INT,
84
+                'description' =>
85 85
                 'The `Int` scalar type represents non-fractional signed whole numeric ' .
86 86
                 'values. Int can represent values between -(2^31) and 2^31 - 1.',
87
-              'serialize' => function ($value) use ($coercer) {
88
-                  return $coercer->coerce($value);
89
-              },
90
-              'parseValue' => function ($value) use ($coercer) {
91
-                  return $coercer->coerce($value);
92
-              },
93
-              'parseLiteral' => function (NodeInterface $node) {
94
-                  if ($node instanceof IntValueNode) {
95
-                      $value = (int)$node->getValue();
96
-                      if ((string)$node->getValue() === (string)$value &&
87
+                'serialize' => function ($value) use ($coercer) {
88
+                    return $coercer->coerce($value);
89
+                },
90
+                'parseValue' => function ($value) use ($coercer) {
91
+                    return $coercer->coerce($value);
92
+                },
93
+                'parseLiteral' => function (NodeInterface $node) {
94
+                    if ($node instanceof IntValueNode) {
95
+                        $value = (int)$node->getValue();
96
+                        if ((string)$node->getValue() === (string)$value &&
97 97
                         $value <= PHP_INT_MAX && $value >= PHP_INT_MIN) {
98
-                          return $value;
99
-                      }
100
-                  }
101
-                  return null;
102
-              },
98
+                            return $value;
99
+                        }
100
+                    }
101
+                    return null;
102
+                },
103 103
             ]);
104 104
         }, true/* $shared */)
105
-          ->withArgument(IntCoercer::class);
105
+            ->withArgument(IntCoercer::class);
106 106
 
107 107
         $this->container->add(GraphQL::ID, function (StringCoercer $coercer) {
108 108
             return newScalarType([
109
-              'name' => TypeNameEnum::ID,
110
-              'description' =>
109
+                'name' => TypeNameEnum::ID,
110
+                'description' =>
111 111
                 'The `ID` scalar type represents a unique identifier, often used to ' .
112 112
                 'refetch an object or as key for a cache. The ID type appears in a JSON ' .
113 113
                 'response as a String; however, it is not intended to be human-readable. ' .
114 114
                 'When expected as an input type, any string (such as `"4"`) or integer ' .
115 115
                 '(such as `4`) input value will be accepted as an ID.',
116
-              'serialize' => function ($value) use ($coercer) {
117
-                  return $coercer->coerce($value);
118
-              },
119
-              'parseValue' => function ($value) use ($coercer) {
120
-                  return $coercer->coerce($value);
121
-              },
122
-              'parseLiteral' => function (NodeInterface $node) {
123
-                  if ($node instanceof StringValueNode || $node instanceof IntValueNode) {
124
-                      return $node->getValue();
125
-                  }
126
-                  return null;
127
-              },
116
+                'serialize' => function ($value) use ($coercer) {
117
+                    return $coercer->coerce($value);
118
+                },
119
+                'parseValue' => function ($value) use ($coercer) {
120
+                    return $coercer->coerce($value);
121
+                },
122
+                'parseLiteral' => function (NodeInterface $node) {
123
+                    if ($node instanceof StringValueNode || $node instanceof IntValueNode) {
124
+                        return $node->getValue();
125
+                    }
126
+                    return null;
127
+                },
128 128
             ]);
129 129
         }, true/* $shared */)
130
-          ->withArgument(StringCoercer::class);
130
+            ->withArgument(StringCoercer::class);
131 131
 
132 132
         $this->container->add(GraphQL::STRING,
133
-          function (StringCoercer $coercer) {
134
-              return newScalarType([
133
+            function (StringCoercer $coercer) {
134
+                return newScalarType([
135 135
                 'name' => TypeNameEnum::STRING,
136 136
                 'description' =>
137
-                  'The `String` scalar type represents textual data, represented as UTF-8 ' .
138
-                  'character sequences. The String type is most often used by GraphQL to ' .
139
-                  'represent free-form human-readable text.',
137
+                    'The `String` scalar type represents textual data, represented as UTF-8 ' .
138
+                    'character sequences. The String type is most often used by GraphQL to ' .
139
+                    'represent free-form human-readable text.',
140 140
                 'serialize' => function ($value) use ($coercer) {
141 141
                     return $coercer->coerce($value);
142 142
                 },
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
                     }
150 150
                     return null;
151 151
                 },
152
-              ]);
153
-          }, true/* $shared */)
154
-          ->withArgument(StringCoercer::class);
152
+                ]);
153
+            }, true/* $shared */)
154
+            ->withArgument(StringCoercer::class);
155 155
     }
156 156
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
     public function register()
36 36
     {
37 37
         $this->container->add(GraphQL::BOOLEAN,
38
-          function (BooleanCoercer $coercer) {
38
+          function(BooleanCoercer $coercer) {
39 39
               return newScalarType([
40 40
                 'name' => TypeNameEnum::BOOLEAN,
41 41
                 'description' => 'The `Boolean` scalar type represents `true` or `false`.',
42
-                'serialize' => function ($value) use ($coercer) {
42
+                'serialize' => function($value) use ($coercer) {
43 43
                     return $coercer->coerce($value);
44 44
                 },
45
-                'parseValue' => function ($value) use ($coercer) {
45
+                'parseValue' => function($value) use ($coercer) {
46 46
                     return $coercer->coerce($value);
47 47
                 },
48
-                'parseLiteral' => function (NodeInterface $node) {
48
+                'parseLiteral' => function(NodeInterface $node) {
49 49
                     if ($node instanceof BooleanValueNode) {
50 50
                         return $node->getValue();
51 51
                     }
@@ -55,20 +55,20 @@  discard block
 block discarded – undo
55 55
           }, true/* $shared */)
56 56
           ->withArgument(BooleanCoercer::class);
57 57
 
58
-        $this->container->add(GraphQL::FLOAT, function (FloatCoercer $coercer) {
58
+        $this->container->add(GraphQL::FLOAT, function(FloatCoercer $coercer) {
59 59
             return newScalarType([
60 60
               'name' => TypeNameEnum::FLOAT,
61 61
               'description' =>
62 62
                 'The `Float` scalar type represents signed double-precision fractional ' .
63 63
                 'values as specified by ' .
64 64
                 '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
65
-              'serialize' => function ($value) use ($coercer) {
65
+              'serialize' => function($value) use ($coercer) {
66 66
                   return $coercer->coerce($value);
67 67
               },
68
-              'parseValue' => function ($value) use ($coercer) {
68
+              'parseValue' => function($value) use ($coercer) {
69 69
                   return $coercer->coerce($value);
70 70
               },
71
-              'parseLiteral' => function (NodeInterface $node) {
71
+              'parseLiteral' => function(NodeInterface $node) {
72 72
                   if ($node instanceof FloatValueNode || $node instanceof IntValueNode) {
73 73
                       return $node->getValue();
74 74
                   }
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
         }, true/* $shared */)
79 79
           ->withArgument(FloatCoercer::class);
80 80
 
81
-        $this->container->add(GraphQL::INT, function (IntCoercer $coercer) {
81
+        $this->container->add(GraphQL::INT, function(IntCoercer $coercer) {
82 82
             return newScalarType([
83 83
               'name' => TypeNameEnum::INT,
84 84
               'description' =>
85 85
                 'The `Int` scalar type represents non-fractional signed whole numeric ' .
86 86
                 'values. Int can represent values between -(2^31) and 2^31 - 1.',
87
-              'serialize' => function ($value) use ($coercer) {
87
+              'serialize' => function($value) use ($coercer) {
88 88
                   return $coercer->coerce($value);
89 89
               },
90
-              'parseValue' => function ($value) use ($coercer) {
90
+              'parseValue' => function($value) use ($coercer) {
91 91
                   return $coercer->coerce($value);
92 92
               },
93
-              'parseLiteral' => function (NodeInterface $node) {
93
+              'parseLiteral' => function(NodeInterface $node) {
94 94
                   if ($node instanceof IntValueNode) {
95 95
                       $value = (int)$node->getValue();
96 96
                       if ((string)$node->getValue() === (string)$value &&
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }, true/* $shared */)
105 105
           ->withArgument(IntCoercer::class);
106 106
 
107
-        $this->container->add(GraphQL::ID, function (StringCoercer $coercer) {
107
+        $this->container->add(GraphQL::ID, function(StringCoercer $coercer) {
108 108
             return newScalarType([
109 109
               'name' => TypeNameEnum::ID,
110 110
               'description' =>
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
                 'response as a String; however, it is not intended to be human-readable. ' .
114 114
                 'When expected as an input type, any string (such as `"4"`) or integer ' .
115 115
                 '(such as `4`) input value will be accepted as an ID.',
116
-              'serialize' => function ($value) use ($coercer) {
116
+              'serialize' => function($value) use ($coercer) {
117 117
                   return $coercer->coerce($value);
118 118
               },
119
-              'parseValue' => function ($value) use ($coercer) {
119
+              'parseValue' => function($value) use ($coercer) {
120 120
                   return $coercer->coerce($value);
121 121
               },
122
-              'parseLiteral' => function (NodeInterface $node) {
122
+              'parseLiteral' => function(NodeInterface $node) {
123 123
                   if ($node instanceof StringValueNode || $node instanceof IntValueNode) {
124 124
                       return $node->getValue();
125 125
                   }
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
           ->withArgument(StringCoercer::class);
131 131
 
132 132
         $this->container->add(GraphQL::STRING,
133
-          function (StringCoercer $coercer) {
133
+          function(StringCoercer $coercer) {
134 134
               return newScalarType([
135 135
                 'name' => TypeNameEnum::STRING,
136 136
                 'description' =>
137 137
                   'The `String` scalar type represents textual data, represented as UTF-8 ' .
138 138
                   'character sequences. The String type is most often used by GraphQL to ' .
139 139
                   'represent free-form human-readable text.',
140
-                'serialize' => function ($value) use ($coercer) {
140
+                'serialize' => function($value) use ($coercer) {
141 141
                     return $coercer->coerce($value);
142 142
                 },
143
-                'parseValue' => function ($value) use ($coercer) {
143
+                'parseValue' => function($value) use ($coercer) {
144 144
                     return $coercer->coerce($value);
145 145
                 },
146
-                'parseLiteral' => function (NodeInterface $node) {
146
+                'parseLiteral' => function(NodeInterface $node) {
147 147
                     if ($node instanceof StringValueNode) {
148 148
                         return $node->getValue();
149 149
                     }
Please login to merge, or discard this patch.
src/Type/CoercerProvider.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
      * @var array
16 16
      */
17 17
     protected $provides = [
18
-      BooleanCoercer::class,
19
-      FloatCoercer::class,
20
-      IntCoercer::class,
21
-      StringCoercer::class,
18
+        BooleanCoercer::class,
19
+        FloatCoercer::class,
20
+        IntCoercer::class,
21
+        StringCoercer::class,
22 22
     ];
23 23
 
24 24
     /**
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
     public function register()
28 28
     {
29 29
         $this->container->add(BooleanCoercer::class, BooleanCoercer::class,
30
-          true/* $shared */);
30
+            true/* $shared */);
31 31
         $this->container->add(FloatCoercer::class, FloatCoercer::class,
32
-          true/* $shared */);
32
+            true/* $shared */);
33 33
         $this->container->add(IntCoercer::class, IntCoercer::class,
34
-          true/* $shared */);
34
+            true/* $shared */);
35 35
         $this->container->add(StringCoercer::class, StringCoercer::class,
36
-          true/* $shared */);
36
+            true/* $shared */);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.