|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the reliforp/reli-prof package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) sji <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Reli\Lib\PhpInternals\Opcodes; |
|
15
|
|
|
|
|
16
|
|
|
final class OpcodeFactory |
|
17
|
|
|
{ |
|
18
|
|
|
/** @var array<string, class-string<Opcode>> */ |
|
19
|
|
|
private const VERSION_MAP = [ |
|
20
|
|
|
'v70' => OpcodeV70::class, |
|
21
|
|
|
'v71' => OpcodeV71::class, |
|
22
|
|
|
'v72' => OpcodeV72::class, |
|
23
|
|
|
'v73' => OpcodeV73::class, |
|
24
|
|
|
'v74' => OpcodeV74::class, |
|
25
|
|
|
'v80' => OpcodeV80::class, |
|
26
|
|
|
'v81' => OpcodeV81::class, |
|
27
|
|
|
]; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @template TVersion of key-of<self::VERSION_MAP> |
|
31
|
|
|
* @param TVersion $version |
|
|
|
|
|
|
32
|
|
|
* @return ( |
|
|
|
|
|
|
33
|
|
|
* TVersion is 'v70' ? OpcodeV70 : |
|
34
|
|
|
* TVersion is 'v71' ? OpcodeV71 : |
|
35
|
|
|
* TVersion is 'v72' ? OpcodeV72 : |
|
36
|
|
|
* TVersion is 'v73' ? OpcodeV73 : |
|
37
|
|
|
* TVersion is 'v74' ? OpcodeV74 : |
|
38
|
|
|
* TVersion is 'v80' ? OpcodeV80 : |
|
39
|
|
|
* OpcodeV81 |
|
40
|
|
|
* ) |
|
41
|
|
|
*/ |
|
42
|
|
|
public function create(string $version, int $opcode): Opcode |
|
43
|
|
|
{ |
|
44
|
|
|
return match ($version) { |
|
45
|
|
|
'v70' => new OpcodeV70($opcode), |
|
46
|
|
|
'v71' => new OpcodeV71($opcode), |
|
47
|
|
|
'v72' => new OpcodeV72($opcode), |
|
48
|
|
|
'v73' => new OpcodeV73($opcode), |
|
49
|
|
|
'v74' => new OpcodeV74($opcode), |
|
50
|
|
|
'v80' => new OpcodeV80($opcode), |
|
51
|
|
|
'v81' => new OpcodeV81($opcode), |
|
52
|
|
|
}; |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths