2020-09-06 15:50:52 +02:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace PhpParser\Lexer\TokenEmulator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverses emulation direction of the inner emulator.
|
|
|
|
*/
|
2020-09-06 16:31:33 +02:00
|
|
|
final class ReverseEmulator extends TokenEmulator
|
2020-09-06 15:50:52 +02:00
|
|
|
{
|
2020-09-06 16:31:33 +02:00
|
|
|
/** @var TokenEmulator Inner emulator */
|
2020-09-06 15:50:52 +02:00
|
|
|
private $emulator;
|
|
|
|
|
2020-09-06 16:31:33 +02:00
|
|
|
public function __construct(TokenEmulator $emulator) {
|
2020-09-06 15:50:52 +02:00
|
|
|
$this->emulator = $emulator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPhpVersion(): string {
|
|
|
|
return $this->emulator->getPhpVersion();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isEmulationNeeded(string $code): bool {
|
|
|
|
return $this->emulator->isEmulationNeeded($code);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function emulate(string $code, array $tokens): array {
|
|
|
|
return $this->emulator->reverseEmulate($code, $tokens);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function reverseEmulate(string $code, array $tokens): array {
|
|
|
|
return $this->emulator->emulate($code, $tokens);
|
|
|
|
}
|
2020-09-06 16:31:33 +02:00
|
|
|
|
|
|
|
public function preprocessCode(string $code, array &$patches): string {
|
|
|
|
return $code;
|
|
|
|
}
|
2020-09-06 15:50:52 +02:00
|
|
|
}
|