Completed
Pull Request — master (#188)
by Sebastian
06:47 queued 27s
created
src/Language/TokenReader.php 1 patch
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
      * {@inheritdoc}
35 35
      */
36 36
     public function read(
37
-      int $code,
38
-      int $pos,
39
-      int $line,
40
-      int $col,
41
-      Token $prev
37
+        int $code,
38
+        int $pos,
39
+        int $line,
40
+        int $col,
41
+        Token $prev
42 42
     ): Token {
43 43
         switch ($code) {
44 44
             case 33: // !
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
      * @return \Digia\GraphQL\Language\Token
108 108
      */
109 109
     protected function readName(
110
-      int $code,
111
-      int $pos,
112
-      int $line,
113
-      int $col,
114
-      Token $prev
110
+        int $code,
111
+        int $pos,
112
+        int $line,
113
+        int $col,
114
+        Token $prev
115 115
     ): Token {
116 116
         $body = $this->lexer->getBody();
117 117
         $bodyLength = mb_strlen($body);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         }
125 125
 
126 126
         return new Token(TokenKindEnum::NAME, $start, $pos, $line, $col, $prev,
127
-          sliceString($body, $start, $pos));
127
+            sliceString($body, $start, $pos));
128 128
     }
129 129
 
130 130
     /**
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
      * @throws \Digia\GraphQL\Error\SyntaxErrorException
139 139
      */
140 140
     protected function readBlockString(
141
-      int $code,
142
-      int $pos,
143
-      int $line,
144
-      int $col,
145
-      Token $prev
141
+        int $code,
142
+        int $pos,
143
+        int $line,
144
+        int $col,
145
+        Token $prev
146 146
     ): Token {
147 147
         $body = $this->lexer->getBody();
148 148
         $bodyLength = mb_strlen($body);
@@ -158,21 +158,21 @@  discard block
 block discarded – undo
158 158
                 $rawValue .= sliceString($body, $chunkStart, $pos);
159 159
 
160 160
                 return new Token(
161
-                  TokenKindEnum::BLOCK_STRING,
162
-                  $start,
163
-                  $pos + 3,
164
-                  $line,
165
-                  $col,
166
-                  $prev,
167
-                  blockStringValue($rawValue)
161
+                    TokenKindEnum::BLOCK_STRING,
162
+                    $start,
163
+                    $pos + 3,
164
+                    $line,
165
+                    $col,
166
+                    $prev,
167
+                    blockStringValue($rawValue)
168 168
                 );
169 169
             }
170 170
 
171 171
             if (isSourceCharacter($code)) {
172 172
                 throw new SyntaxErrorException(
173
-                  $this->lexer->getSource(),
174
-                  $pos,
175
-                  sprintf('Invalid character within String: %s',
173
+                    $this->lexer->getSource(),
174
+                    $pos,
175
+                    sprintf('Invalid character within String: %s',
176 176
                     printCharCode($code))
177 177
                 );
178 178
             }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         }
188 188
 
189 189
         throw new SyntaxErrorException($this->lexer->getSource(), $pos,
190
-          'Unterminated string.');
190
+            'Unterminated string.');
191 191
     }
192 192
 
193 193
     /**
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
      * @throws \Digia\GraphQL\Error\SyntaxErrorException
202 202
      */
203 203
     protected function readNumber(
204
-      int $code,
205
-      int $pos,
206
-      int $line,
207
-      int $col,
208
-      Token $prev
204
+        int $code,
205
+        int $pos,
206
+        int $line,
207
+        int $col,
208
+        Token $prev
209 209
     ): Token {
210 210
         $body = $this->lexer->getBody();
211 211
         $start = $pos;
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
             $code = charCodeAt($body, ++$pos);
222 222
             if (isNumber($code)) {
223 223
                 throw new SyntaxErrorException(
224
-                  $this->lexer->getSource(),
225
-                  $pos,
226
-                  sprintf('Invalid number, unexpected digit after 0: %s.',
224
+                    $this->lexer->getSource(),
225
+                    $pos,
226
+                    sprintf('Invalid number, unexpected digit after 0: %s.',
227 227
                     printCharCode($code))
228 228
                 );
229 229
             }
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
         }
255 255
 
256 256
         return new Token(
257
-          $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT,
258
-          $start,
259
-          $pos,
260
-          $line,
261
-          $col,
262
-          $prev,
263
-          sliceString($body, $start, $pos)
257
+            $isFloat ? TokenKindEnum::FLOAT : TokenKindEnum::INT,
258
+            $start,
259
+            $pos,
260
+            $line,
261
+            $col,
262
+            $prev,
263
+            sliceString($body, $start, $pos)
264 264
         );
265 265
     }
266 266
 
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
      * @throws \Digia\GraphQL\Error\SyntaxErrorException
276 276
      */
277 277
     protected function readString(
278
-      int $code,
279
-      int $pos,
280
-      int $line,
281
-      int $col,
282
-      Token $prev
278
+        int $code,
279
+        int $pos,
280
+        int $line,
281
+        int $col,
282
+        Token $prev
283 283
     ): Token {
284 284
         $body = $this->lexer->getBody();
285 285
         $bodyLength = mb_strlen($body);
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
                 $value .= sliceString($body, $chunkStart, $pos);
296 296
 
297 297
                 return new Token(TokenKindEnum::STRING, $start, $pos + 1, $line,
298
-                  $col, $prev, $value);
298
+                    $col, $prev, $value);
299 299
             }
300 300
 
301 301
             if ($this->isSourceCharacter($code)) {
302 302
                 throw new SyntaxErrorException(
303
-                  $this->lexer->getSource(),
304
-                  $pos,
305
-                  sprintf('Invalid character within String: %s',
303
+                    $this->lexer->getSource(),
304
+                    $pos,
305
+                    sprintf('Invalid character within String: %s',
306 306
                     printCharCode($code))
307 307
                 );
308 308
             }
@@ -342,19 +342,19 @@  discard block
 block discarded – undo
342 342
                     case 117:
343 343
                         // u
344 344
                         $charCode = uniCharCode(
345
-                          charCodeAt($body, $pos + 1),
346
-                          charCodeAt($body, $pos + 2),
347
-                          charCodeAt($body, $pos + 3),
348
-                          charCodeAt($body, $pos + 4)
345
+                            charCodeAt($body, $pos + 1),
346
+                            charCodeAt($body, $pos + 2),
347
+                            charCodeAt($body, $pos + 3),
348
+                            charCodeAt($body, $pos + 4)
349 349
                         );
350 350
                         if ($charCode < 0) {
351 351
                             throw new SyntaxErrorException(
352
-                              $this->lexer->getSource(),
353
-                              $pos,
354
-                              sprintf(
352
+                                $this->lexer->getSource(),
353
+                                $pos,
354
+                                sprintf(
355 355
                                 'Invalid character escape sequence: \\u%s',
356 356
                                 sliceString($body, $pos + 1, $pos + 5)
357
-                              )
357
+                                )
358 358
                             );
359 359
                         }
360 360
                         $value .= chr($charCode);
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
                         break;
363 363
                     default:
364 364
                         throw new SyntaxErrorException(
365
-                          $this->lexer->getSource(),
366
-                          $pos,
367
-                          sprintf('Invalid character escape sequence: \\%s',
365
+                            $this->lexer->getSource(),
366
+                            $pos,
367
+                            sprintf('Invalid character escape sequence: \\%s',
368 368
                             chr($code))
369 369
                         );
370 370
                 }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         }
376 376
 
377 377
         throw new SyntaxErrorException($this->lexer->getSource(), $pos,
378
-          'Unterminated string.');
378
+            'Unterminated string.');
379 379
     }
380 380
 
381 381
     /**
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
      * @return \Digia\GraphQL\Language\Token
389 389
      */
390 390
     protected function readSpread(
391
-      int $code,
392
-      int $pos,
393
-      int $line,
394
-      int $col,
395
-      Token $prev
391
+        int $code,
392
+        int $pos,
393
+        int $line,
394
+        int $col,
395
+        Token $prev
396 396
     ): Token {
397 397
         return new Token(TokenKindEnum::SPREAD, $pos, $pos + 3, $line, $col,
398
-          $prev);
398
+            $prev);
399 399
     }
400 400
 
401 401
     /**
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
      * @return \Digia\GraphQL\Language\Token
409 409
      */
410 410
     protected function readDollar(
411
-      int $code,
412
-      int $pos,
413
-      int $line,
414
-      int $col,
415
-      Token $prev
411
+        int $code,
412
+        int $pos,
413
+        int $line,
414
+        int $col,
415
+        Token $prev
416 416
     ): Token {
417 417
         return new Token(TokenKindEnum::DOLLAR, $pos, $pos + 1, $line, $col,
418
-          $prev);
418
+            $prev);
419 419
     }
420 420
 
421 421
     /**
@@ -428,14 +428,14 @@  discard block
 block discarded – undo
428 428
      * @return \Digia\GraphQL\Language\Token
429 429
      */
430 430
     protected function readPipe(
431
-      int $code,
432
-      int $pos,
433
-      int $line,
434
-      int $col,
435
-      Token $prev
431
+        int $code,
432
+        int $pos,
433
+        int $line,
434
+        int $col,
435
+        Token $prev
436 436
     ): Token {
437 437
         return new Token(TokenKindEnum::PIPE, $pos, $pos + 1, $line, $col,
438
-          $prev);
438
+            $prev);
439 439
     }
440 440
 
441 441
     /**
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
      * @return \Digia\GraphQL\Language\Token
449 449
      */
450 450
     protected function readParenthesis(
451
-      int $code,
452
-      int $pos,
453
-      int $line,
454
-      int $col,
455
-      Token $prev
451
+        int $code,
452
+        int $pos,
453
+        int $line,
454
+        int $col,
455
+        Token $prev
456 456
     ): Token {
457 457
         return $code === 40
458 458
           ? new Token(TokenKindEnum::PAREN_L, $pos, $pos + 1, $line, $col,
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
      * @return \Digia\GraphQL\Language\Token
472 472
      */
473 473
     protected function readEquals(
474
-      int $code,
475
-      int $pos,
476
-      int $line,
477
-      int $col,
478
-      Token $prev
474
+        int $code,
475
+        int $pos,
476
+        int $line,
477
+        int $col,
478
+        Token $prev
479 479
     ): Token {
480 480
         return new Token(TokenKindEnum::EQUALS, $pos, $pos + 1, $line, $col,
481
-          $prev);
481
+            $prev);
482 482
     }
483 483
 
484 484
     /**
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
      * @return \Digia\GraphQL\Language\Token
492 492
      */
493 493
     protected function readAt(
494
-      int $code,
495
-      int $pos,
496
-      int $line,
497
-      int $col,
498
-      Token $prev
494
+        int $code,
495
+        int $pos,
496
+        int $line,
497
+        int $col,
498
+        Token $prev
499 499
     ): Token {
500 500
         return new Token(TokenKindEnum::AT, $pos, $pos + 1, $line, $col, $prev);
501 501
     }
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
      * @return \Digia\GraphQL\Language\Token
511 511
      */
512 512
     protected function readComment(
513
-      int $code,
514
-      int $pos,
515
-      int $line,
516
-      int $col,
517
-      Token $prev
513
+        int $code,
514
+        int $pos,
515
+        int $line,
516
+        int $col,
517
+        Token $prev
518 518
     ): Token {
519 519
         $body = $this->lexer->getBody();
520 520
         $start = $pos;
@@ -524,13 +524,13 @@  discard block
 block discarded – undo
524 524
         } while ($code !== null && ($code > 0x001f || $code === 0x0009)); // SourceCharacter but not LineTerminator
525 525
 
526 526
         return new Token(
527
-          TokenKindEnum::COMMENT,
528
-          $start,
529
-          $pos,
530
-          $line,
531
-          $col,
532
-          $prev,
533
-          sliceString($body, $start + 1, $pos)
527
+            TokenKindEnum::COMMENT,
528
+            $start,
529
+            $pos,
530
+            $line,
531
+            $col,
532
+            $prev,
533
+            sliceString($body, $start + 1, $pos)
534 534
         );
535 535
     }
536 536
 
@@ -544,14 +544,14 @@  discard block
 block discarded – undo
544 544
      * @return \Digia\GraphQL\Language\Token
545 545
      */
546 546
     protected function readColon(
547
-      int $code,
548
-      int $pos,
549
-      int $line,
550
-      int $col,
551
-      Token $prev
547
+        int $code,
548
+        int $pos,
549
+        int $line,
550
+        int $col,
551
+        Token $prev
552 552
     ): Token {
553 553
         return new Token(TokenKindEnum::COLON, $pos, $pos + 1, $line, $col,
554
-          $prev);
554
+            $prev);
555 555
     }
556 556
 
557 557
     /**
@@ -564,14 +564,14 @@  discard block
 block discarded – undo
564 564
      * @return \Digia\GraphQL\Language\Token
565 565
      */
566 566
     protected function readAmp(
567
-      int $code,
568
-      int $pos,
569
-      int $line,
570
-      int $col,
571
-      Token $prev
567
+        int $code,
568
+        int $pos,
569
+        int $line,
570
+        int $col,
571
+        Token $prev
572 572
     ): Token {
573 573
         return new Token(TokenKindEnum::AMP, $pos, $pos + 1, $line, $col,
574
-          $prev);
574
+            $prev);
575 575
     }
576 576
 
577 577
     /**
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
      * @return \Digia\GraphQL\Language\Token
585 585
      */
586 586
     protected function readBang(
587
-      int $code,
588
-      int $pos,
589
-      int $line,
590
-      int $col,
591
-      Token $prev
587
+        int $code,
588
+        int $pos,
589
+        int $line,
590
+        int $col,
591
+        Token $prev
592 592
     ): Token {
593 593
         return new Token(TokenKindEnum::BANG, $pos, $pos + 1, $line, $col,
594
-          $prev);
594
+            $prev);
595 595
     }
596 596
 
597 597
     /**
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
      * @return \Digia\GraphQL\Language\Token
605 605
      */
606 606
     protected function readBrace(
607
-      int $code,
608
-      int $pos,
609
-      int $line,
610
-      int $col,
611
-      Token $prev
607
+        int $code,
608
+        int $pos,
609
+        int $line,
610
+        int $col,
611
+        Token $prev
612 612
     ): Token {
613 613
         return $code === 123
614 614
           ? new Token(TokenKindEnum::BRACE_L, $pos, $pos + 1, $line, $col,
@@ -627,11 +627,11 @@  discard block
 block discarded – undo
627 627
      * @return \Digia\GraphQL\Language\Token
628 628
      */
629 629
     protected function readBracket(
630
-      int $code,
631
-      int $pos,
632
-      int $line,
633
-      int $col,
634
-      Token $prev
630
+        int $code,
631
+        int $pos,
632
+        int $line,
633
+        int $col,
634
+        Token $prev
635 635
     ): Token {
636 636
         return $code === 91
637 637
           ? new Token(TokenKindEnum::BRACKET_L, $pos, $pos + 1, $line, $col,
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
         }
661 661
 
662 662
         throw new SyntaxErrorException(
663
-          $this->lexer->getSource(),
664
-          $pos,
665
-          sprintf('Invalid number, expected digit but got: %s',
663
+            $this->lexer->getSource(),
664
+            $pos,
665
+            sprintf('Invalid number, expected digit but got: %s',
666 666
             printCharCode($code))
667 667
         );
668 668
     }
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
      * @return bool
717 717
      */
718 718
     protected function isEscapedTripleQuote(
719
-      string $body,
720
-      int $code,
721
-      int $pos
719
+        string $body,
720
+        int $code,
721
+        int $pos
722 722
     ): bool {
723 723
         return $code === 92 &&
724 724
           charCodeAt($body, $pos + 1) === 34 &&
Please login to merge, or discard this patch.
src/Language/Lexer.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
195 195
     public function read(int $code, int $pos, int $line, int $col, Token $prev): Token
196 196
     {
197 197
         if ($token = $this->reader->read($code, $pos, $line, $col, $prev)) {
198
-          return $token;
198
+            return $token;
199 199
         }
200 200
 
201 201
         throw new SyntaxErrorException($this->source, $pos, $this->unexpectedCharacterMessage($code));
Please login to merge, or discard this patch.
src/Language/LanguageProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@
 block discarded – undo
31 31
      */
32 32
     public function register()
33 33
     {
34
-        $this->container->add(ASTDirectorInterface::class, function () {
34
+        $this->container->add(ASTDirectorInterface::class, function() {
35 35
             return new ASTDirector(SupportedASTBuilders::get());
36 36
         });
37 37
 
38
-        $this->container->add(NodeDirectorInterface::class, function () {
38
+        $this->container->add(NodeDirectorInterface::class, function() {
39 39
             return new NodeDirector(SupportedNodeBuilders::get());
40 40
         });
41 41
 
Please login to merge, or discard this patch.
src/Language/TokenReaderInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
      * @return Token
16 16
      */
17 17
     public function read(
18
-      int $code,
19
-      int $pos,
20
-      int $line,
21
-      int $col,
22
-      Token $prev
18
+        int $code,
19
+        int $pos,
20
+        int $line,
21
+        int $col,
22
+        Token $prev
23 23
     ): Token;
24 24
 
25 25
     /**
Please login to merge, or discard this patch.