Passed
Pull Request — master (#190)
by Sebastian
03:03
created
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.