|
313 | 313 | $children[0] ?? null, |
314 | 314 | ); |
315 | 315 | }, |
316 | | - 50 => static function (\Phplrt\Parser\Context $ctx, $children) { |
| 316 | + 50 => function (\Phplrt\Parser\Context $ctx, $children) { |
| 317 | + // The "$offset" variable is an auto-generated |
| 318 | + $offset = $ctx->lastProcessedToken->getOffset(); |
| 319 | + |
| 320 | + if ($this->generics === false) { |
| 321 | + throw FeatureNotAllowedException::fromFeature('template arguments', $offset); |
| 322 | + } |
| 323 | + |
317 | 324 | return new Node\Stmt\Template\ArgumentsListNode($children); |
318 | 325 | }, |
319 | 326 | 54 => static function (\Phplrt\Parser\Context $ctx, $children) { |
|
511 | 518 | $children[4], |
512 | 519 | ); |
513 | 520 | }, |
514 | | - 123 => static function (\Phplrt\Parser\Context $ctx, $children) { |
| 521 | + 123 => function (\Phplrt\Parser\Context $ctx, $children) { |
| 522 | + // The "$offset" variable is an auto-generated |
| 523 | + $offset = $ctx->lastProcessedToken->getOffset(); |
| 524 | + |
515 | 525 | if (\count($children) === 2) { |
| 526 | + if ($this->union === false) { |
| 527 | + throw FeatureNotAllowedException::fromFeature('union types', $offset); |
| 528 | + } |
| 529 | + |
516 | 530 | return new Node\Stmt\UnionTypeNode($children[0], $children[1]); |
517 | 531 | } |
518 | 532 |
|
519 | 533 | return $children; |
520 | 534 | }, |
521 | | - 124 => static function (\Phplrt\Parser\Context $ctx, $children) { |
| 535 | + 124 => function (\Phplrt\Parser\Context $ctx, $children) { |
| 536 | + // The "$offset" variable is an auto-generated |
| 537 | + $offset = $ctx->lastProcessedToken->getOffset(); |
| 538 | + |
522 | 539 | if (\count($children) === 2) { |
| 540 | + if ($this->intersection === false) { |
| 541 | + throw FeatureNotAllowedException::fromFeature('intersection types', $offset); |
| 542 | + } |
| 543 | + |
523 | 544 | return new Node\Stmt\IntersectionTypeNode($children[0], $children[1]); |
524 | 545 | } |
525 | 546 |
|
|
532 | 553 |
|
533 | 554 | return $children; |
534 | 555 | }, |
535 | | - 133 => static function (\Phplrt\Parser\Context $ctx, $children) { |
| 556 | + 133 => function (\Phplrt\Parser\Context $ctx, $children) { |
| 557 | + // The "$offset" variable is an auto-generated |
| 558 | + $offset = $ctx->lastProcessedToken->getOffset(); |
| 559 | + |
536 | 560 | $statement = \array_shift($children); |
537 | 561 |
|
538 | 562 | for ($i = 0, $length = \count($children); $i < $length; ++$i) { |
| 563 | + if ($this->list === false) { |
| 564 | + throw FeatureNotAllowedException::fromFeature('square bracket list types', $offset); |
| 565 | + } |
| 566 | + |
539 | 567 | $statement = new Node\Stmt\TypesListNode($statement); |
540 | 568 | $statement->offset = $children[$i]->getOffset(); |
541 | 569 | } |
|
0 commit comments