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 $exposedClassNames; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var list<string> |
36
|
|
|
*/ |
37
|
|
|
private array $exposedClassRegexes; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var list<string> |
41
|
|
|
*/ |
42
|
|
|
private array $exposedFunctionNames; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var list<string> |
46
|
|
|
*/ |
47
|
|
|
private array $exposedFunctionRegexes; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var list<string> |
51
|
|
|
*/ |
52
|
|
|
private array $exposedConstantNames; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var list<string> |
56
|
|
|
*/ |
57
|
|
|
private array $exposedConstantRegexes; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param string[] $exposedClassNames |
61
|
|
|
* @param string[] $exposedClassRegexes |
62
|
|
|
* @param string[] $exposedFunctionNames |
63
|
|
|
* @param string[] $exposedFunctionRegexes |
64
|
|
|
* @param string[] $exposedConstantNames |
65
|
|
|
* @param string[] $exposedConstantRegexes |
66
|
|
|
*/ |
67
|
|
|
public static function create( |
68
|
|
|
bool $exposeGlobalConstants = false, |
69
|
|
|
bool $exposeGlobalClasses = false, |
70
|
|
|
bool $exposeGlobalFunctions = false, |
71
|
|
|
?NamespaceRegistry $excludedNamespaces = null, |
72
|
|
|
// Does not contain the list of excluded symbols which go to the |
73
|
|
|
// Reflector (which has no notion of namespaces) |
74
|
|
|
?NamespaceRegistry $exposedNamespaces = null, |
75
|
|
|
array $exposedClassNames = [], |
76
|
|
|
array $exposedClassRegexes = [], |
77
|
|
|
array $exposedFunctionNames = [], |
78
|
|
|
array $exposedFunctionRegexes = [], |
79
|
|
|
array $exposedConstantNames = [], |
80
|
|
|
array $exposedConstantRegexes = [] |
81
|
|
|
): self { |
82
|
|
|
return new self( |
83
|
|
|
$exposeGlobalConstants, |
84
|
|
|
$exposeGlobalClasses, |
85
|
|
|
$exposeGlobalFunctions, |
86
|
|
|
$excludedNamespaces ?? NamespaceRegistry::create(), |
87
|
|
|
$exposedNamespaces ?? NamespaceRegistry::create(), |
88
|
|
|
array_unique($exposedClassNames), |
89
|
|
|
array_unique($exposedClassRegexes), |
90
|
|
|
array_unique($exposedFunctionNames), |
91
|
|
|
array_unique($exposedFunctionRegexes), |
92
|
|
|
array_unique($exposedConstantNames), |
93
|
|
|
array_unique($exposedConstantRegexes), |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param list<string> $exposedClassNames |
99
|
|
|
* @param list<string> $exposedClassRegexes |
100
|
|
|
* @param list<string> $exposedFunctionNames |
101
|
|
|
* @param list<string> $exposedFunctionRegexes |
102
|
|
|
* @param list<string> $exposedConstantNames |
103
|
|
|
* @param list<string> $exposedConstantRegexes |
104
|
|
|
*/ |
105
|
|
|
private function __construct( |
106
|
|
|
bool $exposeGlobalConstants, |
107
|
|
|
bool $exposeGlobalClasses, |
108
|
|
|
bool $exposeGlobalFunctions, |
109
|
|
|
NamespaceRegistry $excludedNamespaces, |
110
|
|
|
NamespaceRegistry $exposedNamespaces, |
111
|
|
|
array $exposedClassNames, |
112
|
|
|
array $exposedClassRegexes, |
113
|
|
|
array $exposedFunctionNames, |
114
|
|
|
array $exposedFunctionRegexes, |
115
|
|
|
array $exposedConstantNames, |
116
|
|
|
array $exposedConstantRegexes |
117
|
|
|
) { |
118
|
|
|
$this->exposeGlobalConstants = $exposeGlobalConstants; |
119
|
|
|
$this->exposeGlobalClasses = $exposeGlobalClasses; |
120
|
|
|
$this->exposeGlobalFunctions = $exposeGlobalFunctions; |
121
|
|
|
$this->excludedNamespaces = $excludedNamespaces; |
122
|
|
|
$this->exposedNamespaces = $exposedNamespaces; |
123
|
|
|
$this->exposedClassNames = $exposedClassNames; |
|
|
|
|
124
|
|
|
$this->exposedClassRegexes = $exposedClassRegexes; |
|
|
|
|
125
|
|
|
$this->exposedFunctionNames = $exposedFunctionNames; |
|
|
|
|
126
|
|
|
$this->exposedFunctionRegexes = $exposedFunctionRegexes; |
|
|
|
|
127
|
|
|
$this->exposedConstantNames = $exposedConstantNames; |
|
|
|
|
128
|
|
|
$this->exposedConstantRegexes = $exposedConstantRegexes; |
|
|
|
|
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function shouldExposeGlobalConstants(): bool |
132
|
|
|
{ |
133
|
|
|
return $this->exposeGlobalConstants; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function shouldExposeGlobalClasses(): bool |
137
|
|
|
{ |
138
|
|
|
return $this->exposeGlobalClasses; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function shouldExposeGlobalFunctions(): bool |
142
|
|
|
{ |
143
|
|
|
return $this->exposeGlobalFunctions; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function getExcludedNamespaces(): NamespaceRegistry |
147
|
|
|
{ |
148
|
|
|
return $this->excludedNamespaces; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function getExposedNamespaces(): NamespaceRegistry |
152
|
|
|
{ |
153
|
|
|
return $this->exposedNamespaces; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return list<string> |
158
|
|
|
*/ |
159
|
|
|
public function getExposedClassNames(): array |
160
|
|
|
{ |
161
|
|
|
return $this->exposedClassNames; |
|
|
|
|
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return list<string> |
166
|
|
|
*/ |
167
|
|
|
public function getExposedClassRegexes(): array |
168
|
|
|
{ |
169
|
|
|
return $this->exposedClassRegexes; |
|
|
|
|
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return list<string> |
174
|
|
|
*/ |
175
|
|
|
public function getExposedFunctionNames(): array |
176
|
|
|
{ |
177
|
|
|
return $this->exposedFunctionNames; |
|
|
|
|
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @return list<string> |
182
|
|
|
*/ |
183
|
|
|
public function getExposedFunctionRegexes(): array |
184
|
|
|
{ |
185
|
|
|
return $this->exposedFunctionRegexes; |
|
|
|
|
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return list<string> |
190
|
|
|
*/ |
191
|
|
|
public function getExposedConstantNames(): array |
192
|
|
|
{ |
193
|
|
|
return $this->exposedConstantNames; |
|
|
|
|
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @return list<string> |
198
|
|
|
*/ |
199
|
|
|
public function getExposedConstantRegexes(): array |
200
|
|
|
{ |
201
|
|
|
return $this->exposedConstantRegexes; |
|
|
|
|
202
|
|
|
} |
203
|
|
|
} |
204
|
|
|
|
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