1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the humbug/php-scoper package. |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2017 Théo FIDRY <[email protected]>, |
9
|
|
|
* Pádraic Brady <[email protected]> |
10
|
|
|
* |
11
|
|
|
* For the full copyright and license information, please view the LICENSE |
12
|
|
|
* file that was distributed with this source code. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Humbug\PhpScoper\Symbol; |
16
|
|
|
|
17
|
|
|
use Countable; |
18
|
|
|
use PhpParser\Node\Name\FullyQualified; |
19
|
|
|
use function array_values; |
20
|
|
|
use function count; |
21
|
|
|
|
22
|
|
|
final class SymbolsRegistry implements Countable |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var array<string, array{string, string}> |
26
|
|
|
*/ |
27
|
|
|
private array $recordedFunctions = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var array<string, array{string, string}> |
31
|
|
|
*/ |
32
|
|
|
private array $recordedClasses = []; |
33
|
|
|
|
34
|
|
|
public static function createFromRegistries(array $symbolsRegistries): self |
35
|
|
|
{ |
36
|
|
|
$symbolsRegistry = new self(); |
37
|
|
|
|
38
|
|
|
foreach ($symbolsRegistries as $symbolsRegistryToMerge) { |
39
|
|
|
$symbolsRegistry->merge($symbolsRegistryToMerge); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
return $symbolsRegistry; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function merge(self $symbolsRegistry): void |
46
|
|
|
{ |
47
|
|
|
foreach ($symbolsRegistry->getRecordedFunctions() as [$original, $alias]) { |
48
|
|
|
$this->recordedFunctions[$original] = [$original, $alias]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
foreach ($symbolsRegistry->getRecordedClasses() as [$original, $alias]) { |
52
|
|
|
$this->recordedClasses[$original] = [$original, $alias]; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function recordFunction(FullyQualified $original, FullyQualified $alias): void |
57
|
|
|
{ |
58
|
|
|
$this->recordedFunctions[(string) $original] = [(string) $original, (string) $alias]; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return list<array{string, string}> |
|
|
|
|
63
|
|
|
*/ |
64
|
|
|
public function getRecordedFunctions(): array |
65
|
|
|
{ |
66
|
|
|
return array_values($this->recordedFunctions); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function recordClass(FullyQualified $original, FullyQualified $alias): void |
70
|
|
|
{ |
71
|
|
|
$this->recordedClasses[(string) $original] = [(string) $original, (string) $alias]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return list<array{string, string}> |
76
|
|
|
*/ |
77
|
|
|
public function getRecordedClasses(): array |
78
|
|
|
{ |
79
|
|
|
return array_values($this->recordedClasses); |
|
|
|
|
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function count(): int |
83
|
|
|
{ |
84
|
|
|
return count($this->recordedFunctions) + count($this->recordedClasses); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
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