1<?php declare(strict_types=1);
2
3namespace PhpParser\Lexer\TokenEmulator;
4
5use PhpParser\PhpVersion;
6
7/**
8 * Reverses emulation direction of the inner emulator.
9 */
10final class ReverseEmulator extends TokenEmulator {
11    /** @var TokenEmulator Inner emulator */
12    private TokenEmulator $emulator;
13
14    public function __construct(TokenEmulator $emulator) {
15        $this->emulator = $emulator;
16    }
17
18    public function getPhpVersion(): PhpVersion {
19        return $this->emulator->getPhpVersion();
20    }
21
22    public function isEmulationNeeded(string $code): bool {
23        return $this->emulator->isEmulationNeeded($code);
24    }
25
26    public function emulate(string $code, array $tokens): array {
27        return $this->emulator->reverseEmulate($code, $tokens);
28    }
29
30    public function reverseEmulate(string $code, array $tokens): array {
31        return $this->emulator->emulate($code, $tokens);
32    }
33
34    public function preprocessCode(string $code, array &$patches): string {
35        return $code;
36    }
37}
38