PHP 8.2.31
Preview: RectorParser.php Size: 1.13 KB
/opt/cpanel/ea-wappspector/vendor/rector/rector/src/PhpParser/Parser/RectorParser.php

<?php

declare (strict_types=1);
namespace Rector\PhpParser\Parser;

use PhpParser\Lexer;
use PhpParser\Node\Stmt;
use PHPStan\Parser\Parser;
use Rector\PhpParser\ValueObject\StmtsAndTokens;
final class RectorParser
{
    /**
     * @readonly
     * @var \PhpParser\Lexer
     */
    private $lexer;
    /**
     * @readonly
     * @var \PHPStan\Parser\Parser
     */
    private $parser;
    public function __construct(Lexer $lexer, Parser $parser)
    {
        $this->lexer = $lexer;
        $this->parser = $parser;
    }
    /**
     * @api used by rector-symfony
     *
     * @return Stmt[]
     */
    public function parseFile(string $filePath) : array
    {
        return $this->parser->parseFile($filePath);
    }
    /**
     * @return Stmt[]
     */
    public function parseString(string $fileContent) : array
    {
        return $this->parser->parseString($fileContent);
    }
    public function parseFileContentToStmtsAndTokens(string $fileContent) : StmtsAndTokens
    {
        $stmts = $this->parser->parseString($fileContent);
        $tokens = $this->lexer->getTokens();
        return new StmtsAndTokens($stmts, $tokens);
    }
}

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
5.41 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
709 B lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.13 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
2.60 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).