forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParserRunner.php
More file actions
28 lines (23 loc) · 816 Bytes
/
Copy pathParserRunner.php
File metadata and controls
28 lines (23 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php declare(strict_types = 1);
namespace PHPStan\Parser;
use PhpParser\ErrorHandler;
use PhpParser\Node\Stmt;
use PhpParser\Parser;
use PHPStan\Turbo\ShadowedByTurboExtension;
/**
* Seam for the turbo extension's native php-parser engine: the native
* implementation runs the LALR parse natively for PhpParser\Parser\Php8,
* falling back to $parser->parse() for anything else. Without the extension
* this delegation is all there is.
*/
#[ShadowedByTurboExtension(turboClass: 'PHPStanTurbo\ParserRunner', implementation: __DIR__ . '/../../turbo-ext/src/parser/ParserRunner.cpp')]
final class ParserRunner
{
/**
* @return Stmt[]|null
*/
public static function parse(Parser $parser, string $sourceCode, ErrorHandler $errorHandler): ?array
{
return $parser->parse($sourceCode, $errorHandler);
}
}