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\Configuration; |
16
|
|
|
|
17
|
|
|
use Humbug\PhpScoper\Symbol\NamespaceRegistry; |
18
|
|
|
use function array_unique; |
19
|
|
|
|
20
|
|
|
final class SymbolsConfiguration |
21
|
|
|
{ |
22
|
|
|
private bool $exposeGlobalConstants; |
23
|
|
|
private bool $exposeGlobalClasses; |
24
|
|
|
private bool $exposeGlobalFunctions; |
25
|
|
|
|
26
|
|
|
private NamespaceRegistry $excludedNamespaces; |
27
|
|
|
private NamespaceRegistry $exposedNamespaces; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var list<string> |
|
|
|
|
31
|
|
|
*/ |
32
|
|
|
private array $exposedClasses; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var list<string> |
36
|
|
|
*/ |
37
|
|
|
private array $exposedFunctions; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var list<string> |
41
|
|
|
*/ |
42
|
|
|
private array $exposedConstants; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param string[] $excludedNamespaceRegexes |
46
|
|
|
* @param string[] $excludedNamespaceNames |
47
|
|
|
* @param string[] $exposedNamespaceRegexes |
48
|
|
|
* @param string[] $exposedNamespaceNames |
49
|
|
|
* @param string[] $exposedClasses |
50
|
|
|
* @param string[] $exposedFunctions |
51
|
|
|
* @param string[] $exposedConstants |
52
|
|
|
*/ |
53
|
|
|
public static function create( |
54
|
|
|
bool $exposeGlobalConstants = true, |
55
|
|
|
bool $exposeGlobalClasses = true, |
56
|
|
|
bool $exposeGlobalFunctions = true, |
57
|
|
|
?NamespaceRegistry $excludedNamespaces = null, |
58
|
|
|
// Does not contain the list of excluded symbols which go to the |
59
|
|
|
// Reflector (which has no notion of namespaces) |
60
|
|
|
?NamespaceRegistry $exposedNamespaces = null, |
61
|
|
|
array $exposedClasses = [], |
62
|
|
|
array $exposedFunctions = [], |
63
|
|
|
array $exposedConstants = [] |
64
|
|
|
): self { |
65
|
|
|
return new self( |
66
|
|
|
$exposeGlobalConstants, |
67
|
|
|
$exposeGlobalClasses, |
68
|
|
|
$exposeGlobalFunctions, |
69
|
|
|
$excludedNamespaces ?? NamespaceRegistry::create(), |
70
|
|
|
$exposedNamespaces ?? NamespaceRegistry::create(), |
71
|
|
|
array_unique($exposedClasses), |
72
|
|
|
array_unique($exposedFunctions), |
73
|
|
|
array_unique($exposedConstants), |
74
|
|
|
); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param list<string> $exposedClasses |
79
|
|
|
* @param list<string> $exposedFunctions |
80
|
|
|
* @param list<string> $exposedConstants |
81
|
|
|
*/ |
82
|
|
|
public function __construct( |
83
|
|
|
bool $exposeGlobalConstants, |
84
|
|
|
bool $exposeGlobalClasses, |
85
|
|
|
bool $exposeGlobalFunctions, |
86
|
|
|
NamespaceRegistry $excludedNamespaces, |
87
|
|
|
NamespaceRegistry $exposedNamespaces, |
88
|
|
|
array $exposedClasses, |
89
|
|
|
array $exposedFunctions, |
90
|
|
|
array $exposedConstants |
91
|
|
|
) { |
92
|
|
|
$this->exposeGlobalConstants = $exposeGlobalConstants; |
93
|
|
|
$this->exposeGlobalClasses = $exposeGlobalClasses; |
94
|
|
|
$this->exposeGlobalFunctions = $exposeGlobalFunctions; |
95
|
|
|
$this->excludedNamespaces = $excludedNamespaces; |
96
|
|
|
$this->exposedNamespaces = $exposedNamespaces; |
97
|
|
|
$this->exposedClasses = $exposedClasses; |
|
|
|
|
98
|
|
|
$this->exposedFunctions = $exposedFunctions; |
|
|
|
|
99
|
|
|
$this->exposedConstants = $exposedConstants; |
|
|
|
|
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function shouldExposeGlobalConstants(): bool |
103
|
|
|
{ |
104
|
|
|
return $this->exposeGlobalConstants; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function shouldExposeGlobalClasses(): bool |
108
|
|
|
{ |
109
|
|
|
return $this->exposeGlobalClasses; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function shouldExposeGlobalFunctions(): bool |
113
|
|
|
{ |
114
|
|
|
return $this->exposeGlobalFunctions; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function getExcludedNamespaces(): NamespaceRegistry |
118
|
|
|
{ |
119
|
|
|
return $this->excludedNamespaces; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function getExposedNamespaces(): NamespaceRegistry |
123
|
|
|
{ |
124
|
|
|
return $this->exposedNamespaces; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return list<string> |
129
|
|
|
*/ |
130
|
|
|
public function getExposedClasses(): array |
131
|
|
|
{ |
132
|
|
|
return $this->exposedClasses; |
|
|
|
|
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return list<string> |
137
|
|
|
*/ |
138
|
|
|
public function getExposedFunctions(): array |
139
|
|
|
{ |
140
|
|
|
return $this->exposedFunctions; |
|
|
|
|
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return list<string> |
145
|
|
|
*/ |
146
|
|
|
public function getExposedConstants(): array |
147
|
|
|
{ |
148
|
|
|
return $this->exposedConstants; |
|
|
|
|
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|
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