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