Passed
Pull Request — master (#190)
by Sebastian
03:03
created
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.
src/Error/GraphQLException.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param \Throwable|null $originalException
85 85
      */
86 86
     public function __construct(
87
-      string $message,
87
+        string $message,
88 88
       ?array $nodes = null,
89 89
       ?Source $source = null,
90 90
       ?array $positions = null,
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
     {
148 148
         if (null === $positions && !empty($this->nodes)) {
149 149
             $positions = array_reduce($this->nodes,
150
-              function (array $list, ?NodeInterface $node) {
151
-                  if (null !== $node) {
152
-                      $location = $node->getLocation();
153
-                      if (null !== $location) {
154
-                          $list[] = $location->getStart();
155
-                      }
156
-                  }
157
-                  return $list;
158
-              }, []);
150
+                function (array $list, ?NodeInterface $node) {
151
+                    if (null !== $node) {
152
+                        $location = $node->getLocation();
153
+                        if (null !== $location) {
154
+                            $list[] = $location->getStart();
155
+                        }
156
+                    }
157
+                    return $list;
158
+                }, []);
159 159
         }
160 160
 
161 161
         if (null !== $positions && empty($positions)) {
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
             }, $positions);
182 182
         } elseif (!empty($this->nodes)) {
183 183
             $locations = array_reduce($this->nodes,
184
-              function (array $list, NodeInterface $node) {
185
-                  $location = $node->getLocation();
186
-                  if (null !== $location) {
187
-                      $list[] = SourceLocation::fromSource($location->getSource(),
184
+                function (array $list, NodeInterface $node) {
185
+                    $location = $node->getLocation();
186
+                    if (null !== $location) {
187
+                        $list[] = SourceLocation::fromSource($location->getSource(),
188 188
                         $location->getStart());
189
-                  }
190
-                  return $list;
191
-              }, []);
189
+                    }
190
+                    return $list;
191
+                }, []);
192 192
         }
193 193
 
194 194
         if (isset($locations)) {
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
     public function toArray(): array
277 277
     {
278 278
         return [
279
-          'message' => $this->message,
280
-          'locations' => $this->getLocationsAsArray(),
281
-          'path' => $this->path,
279
+            'message' => $this->message,
280
+            'locations' => $this->getLocationsAsArray(),
281
+            'path' => $this->path,
282 282
         ];
283 283
     }
284 284
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     public function getLocationsAsArray(): ?array
289 289
     {
290 290
         return !empty($this->locations) ? array_map(function (
291
-          SourceLocation $location
291
+            SourceLocation $location
292 292
         ) {
293 293
             return $location->toArray();
294 294
         }, $this->locations) : null;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
           ? (!empty($nodes) ? $nodes : [])
114 114
           : (null !== $nodes ? [$nodes] : []);
115 115
 
116
-        $this->nodes = \array_filter($nodes, function ($node) {
116
+        $this->nodes = \array_filter($nodes, function($node) {
117 117
             return null !== $node;
118 118
         });
119 119
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     {
148 148
         if (null === $positions && !empty($this->nodes)) {
149 149
             $positions = array_reduce($this->nodes,
150
-              function (array $list, ?NodeInterface $node) {
150
+              function(array $list, ?NodeInterface $node) {
151 151
                   if (null !== $node) {
152 152
                       $location = $node->getLocation();
153 153
                       if (null !== $location) {
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
     protected function resolveLocations(?array $positions, ?Source $source)
177 177
     {
178 178
         if (null !== $positions && null !== $source) {
179
-            $locations = array_map(function ($position) use ($source) {
179
+            $locations = array_map(function($position) use ($source) {
180 180
                 return SourceLocation::fromSource($source, $position);
181 181
             }, $positions);
182 182
         } elseif (!empty($this->nodes)) {
183 183
             $locations = array_reduce($this->nodes,
184
-              function (array $list, NodeInterface $node) {
184
+              function(array $list, NodeInterface $node) {
185 185
                   $location = $node->getLocation();
186 186
                   if (null !== $location) {
187 187
                       $list[] = SourceLocation::fromSource($location->getSource(),
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      */
288 288
     public function getLocationsAsArray(): ?array
289 289
     {
290
-        return !empty($this->locations) ? array_map(function (
290
+        return !empty($this->locations) ? array_map(function(
291 291
           SourceLocation $location
292 292
         ) {
293 293
             return $location->toArray();
Please login to merge, or discard this patch.
src/Error/helpers.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
     invariant(null !== $error, 'Received null error.');
20 20
 
21 21
     return [
22
-      'message' => $error->getMessage(),
23
-      'locations' => $error->getLocationsAsArray(),
24
-      'path' => $error->getPath(),
22
+        'message' => $error->getMessage(),
23
+        'locations' => $error->getLocationsAsArray(),
24
+        'path' => $error->getPath(),
25 25
     ];
26 26
 }
27 27
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
             $location = $node->getLocation();
43 43
             if (null !== $location) {
44 44
                 $printedLocations[] = highlightSourceAtLocation(
45
-                  $location->getSource(),
46
-                  SourceLocation::fromSource($location->getSource(),
45
+                    $location->getSource(),
46
+                    SourceLocation::fromSource($location->getSource(),
47 47
                     $location->getStart())
48 48
                 );
49 49
             }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     } elseif ($error->hasSource() && $error->hasLocations()) {
52 52
         foreach ($error->getLocations() as $location) {
53 53
             $printedLocations[] = highlightSourceAtLocation($error->getSource(),
54
-              $location);
54
+                $location);
55 55
         }
56 56
     }
57 57
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
  * @return string
69 69
  */
70 70
 function highlightSourceAtLocation(
71
-  Source $source,
72
-  SourceLocation $location
71
+    Source $source,
72
+    SourceLocation $location
73 73
 ): string {
74 74
     $line = $location->getLine();
75 75
     $locationOffset = $source->getLocationOffset();
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
     $lines = \preg_split("/\r\n|[\n\r]/", $source->getBody());
85 85
     $lines[0] = whitespace($locationOffset->getColumn() - 1) . $lines[0];
86 86
     $outputLines = [
87
-      \sprintf('%s (%s:%s)', $source->getName(), $contextLine, $contextColumn),
88
-      $line >= 2 ? leftPad($padLen,
89
-          $prevLineNum) . ': ' . $lines[$line - 2] : null,
90
-      leftPad($padLen, $lineNum) . ': ' . $lines[$line - 1],
91
-      whitespace(2 + $padLen + $contextColumn - 1) . '^',
92
-      $line < \count($lines) ? leftPad($padLen,
93
-          $nextLineNum) . ': ' . $lines[$line] : null,
87
+        \sprintf('%s (%s:%s)', $source->getName(), $contextLine, $contextColumn),
88
+        $line >= 2 ? leftPad($padLen,
89
+            $prevLineNum) . ': ' . $lines[$line - 2] : null,
90
+        leftPad($padLen, $lineNum) . ': ' . $lines[$line - 1],
91
+        whitespace(2 + $padLen + $contextColumn - 1) . '^',
92
+        $line < \count($lines) ? leftPad($padLen,
93
+            $nextLineNum) . ': ' . $lines[$line] : null,
94 94
     ];
95 95
 
96 96
     return \implode("\n", \array_filter($outputLines, function ($line) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
           $nextLineNum) . ': ' . $lines[$line] : null,
94 94
     ];
95 95
 
96
-    return \implode("\n", \array_filter($outputLines, function ($line) {
96
+    return \implode("\n", \array_filter($outputLines, function($line) {
97 97
         return null !== $line;
98 98
     }));
99 99
 }
Please login to merge, or discard this patch.
src/Error/SyntaxErrorException.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@
 block discarded – undo
15 15
      * @param string $description
16 16
      */
17 17
     public function __construct(
18
-      Source $source,
19
-      int $position,
20
-      string $description
18
+        Source $source,
19
+        int $position,
20
+        string $description
21 21
     ) {
22 22
         parent::__construct(
23
-          sprintf('Syntax Error: %s', $description),
24
-          null,
25
-          $source,
26
-          [$position]
23
+            sprintf('Syntax Error: %s', $description),
24
+            null,
25
+            $source,
26
+            [$position]
27 27
         );
28 28
     }
29 29
 }
Please login to merge, or discard this patch.