mirror of
https://github.com/nikic/PHP-Parser.git
synced 2025-01-17 23:28:15 +01:00
31 lines
819 B
PHP
31 lines
819 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace PhpParser\Lexer\TokenEmulator;
|
|
|
|
use PhpParser\PhpVersion;
|
|
use PhpParser\Token;
|
|
|
|
/** @internal */
|
|
abstract class TokenEmulator {
|
|
abstract public function getPhpVersion(): PhpVersion;
|
|
|
|
abstract public function isEmulationNeeded(string $code): bool;
|
|
|
|
/**
|
|
* @param Token[] $tokens Original tokens
|
|
* @return Token[] Modified Tokens
|
|
*/
|
|
abstract public function emulate(string $code, array $tokens): array;
|
|
|
|
/**
|
|
* @param Token[] $tokens Original tokens
|
|
* @return Token[] Modified Tokens
|
|
*/
|
|
abstract public function reverseEmulate(string $code, array $tokens): array;
|
|
|
|
/** @param array{int, string, string}[] $patches */
|
|
public function preprocessCode(string $code, array &$patches): string {
|
|
return $code;
|
|
}
|
|
}
|