1 | <?php |
||
26 | class FileDescriptor extends DescriptorAbstract implements Interfaces\FileInterface |
||
27 | { |
||
28 | /** @var string $hash */ |
||
29 | protected $hash; |
||
30 | |||
31 | /** @var string $path */ |
||
32 | protected $path = ''; |
||
33 | |||
34 | /** @var string|null $source */ |
||
35 | protected $source = null; |
||
36 | |||
37 | /** @var Collection $namespaceAliases */ |
||
38 | protected $namespaceAliases; |
||
39 | |||
40 | /** @var Collection $includes */ |
||
41 | protected $includes; |
||
42 | |||
43 | /** @var Collection $constants */ |
||
44 | protected $constants; |
||
45 | |||
46 | /** @var Collection $functions */ |
||
47 | protected $functions; |
||
48 | |||
49 | /** @var Collection $classes */ |
||
50 | protected $classes; |
||
51 | |||
52 | /** @var Collection $interfaces */ |
||
53 | protected $interfaces; |
||
54 | |||
55 | /** @var Collection $traits */ |
||
56 | protected $traits; |
||
57 | |||
58 | /** @var Collection $markers */ |
||
59 | protected $markers; |
||
60 | |||
61 | /** |
||
62 | * Initializes a new file descriptor with the given hash of its contents. |
||
63 | * |
||
64 | * @param string $hash An MD5 hash of the contents if this file. |
||
65 | */ |
||
66 | 5 | public function __construct($hash) |
|
82 | |||
83 | /** |
||
84 | * Returns the hash of the contents for this file. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 1 | public function getHash() |
|
92 | |||
93 | /** |
||
94 | * Sets the hash of the contents for this file. |
||
95 | * |
||
96 | * @param string $hash |
||
97 | */ |
||
98 | 1 | protected function setHash($hash) |
|
99 | { |
||
100 | 1 | $this->hash = $hash; |
|
101 | 1 | } |
|
102 | |||
103 | /** |
||
104 | * Retrieves the contents of this file. |
||
105 | * |
||
106 | * @return string|null |
||
107 | */ |
||
108 | 2 | public function getSource() |
|
112 | |||
113 | /** |
||
114 | * Sets the source contents for this file. |
||
115 | * |
||
116 | * @param string|null $source |
||
117 | */ |
||
118 | 2 | public function setSource($source) |
|
122 | |||
123 | /** |
||
124 | * Returns the namespace aliases that have been defined in this file. |
||
125 | * |
||
126 | * @return Collection |
||
127 | */ |
||
128 | 1 | public function getNamespaceAliases() |
|
132 | |||
133 | /** |
||
134 | * Sets the collection of namespace aliases for this file. |
||
135 | */ |
||
136 | 2 | public function setNamespaceAliases(Collection $namespaceAliases) |
|
140 | |||
141 | /** |
||
142 | * Returns a list of all includes that have been declared in this file. |
||
143 | * |
||
144 | * @return Collection |
||
145 | */ |
||
146 | 1 | public function getIncludes() |
|
150 | |||
151 | /** |
||
152 | * Sets a list of all includes that have been declared in this file. |
||
153 | */ |
||
154 | 2 | public function setIncludes(Collection $includes) |
|
158 | |||
159 | /** |
||
160 | * Returns a list of constant descriptors contained in this file. |
||
161 | * |
||
162 | * @return Collection |
||
163 | */ |
||
164 | 1 | public function getConstants() |
|
168 | |||
169 | /** |
||
170 | * Sets a list of constant descriptors contained in this file. |
||
171 | */ |
||
172 | 2 | public function setConstants(Collection $constants) |
|
176 | |||
177 | /** |
||
178 | * Returns a list of function descriptors contained in this file. |
||
179 | * |
||
180 | * @return Collection|FunctionInterface[] |
||
181 | */ |
||
182 | 1 | public function getFunctions() |
|
186 | |||
187 | /** |
||
188 | * Sets a list of function descriptors contained in this file. |
||
189 | */ |
||
190 | 2 | public function setFunctions(Collection $functions) |
|
194 | |||
195 | /** |
||
196 | * Returns a list of class descriptors contained in this file. |
||
197 | * |
||
198 | * @return Collection|ClassInterface[] |
||
199 | */ |
||
200 | 1 | public function getClasses() |
|
204 | |||
205 | /** |
||
206 | * Sets a list of class descriptors contained in this file. |
||
207 | */ |
||
208 | 2 | public function setClasses(Collection $classes) |
|
212 | |||
213 | /** |
||
214 | * Returns a list of interface descriptors contained in this file. |
||
215 | * |
||
216 | * @return Collection|InterfaceInterface[] |
||
217 | */ |
||
218 | 1 | public function getInterfaces() |
|
222 | |||
223 | /** |
||
224 | * Sets a list of interface descriptors contained in this file. |
||
225 | */ |
||
226 | 2 | public function setInterfaces(Collection $interfaces) |
|
230 | |||
231 | /** |
||
232 | * Returns a list of trait descriptors contained in this file. |
||
233 | * |
||
234 | * @return Collection|TraitInterface[] |
||
235 | */ |
||
236 | 1 | public function getTraits() |
|
240 | |||
241 | /** |
||
242 | * Sets a list of trait descriptors contained in this file. |
||
243 | */ |
||
244 | 2 | public function setTraits(Collection $traits) |
|
248 | |||
249 | /** |
||
250 | * Returns a series of markers contained in this file. |
||
251 | * |
||
252 | * A marker is a special inline comment that starts with a keyword and is followed by a single line description. |
||
253 | * |
||
254 | * Example: |
||
255 | * ``` |
||
256 | * // TODO: This is an item that needs to be done. |
||
257 | * ``` |
||
258 | * |
||
259 | * @return Collection |
||
260 | */ |
||
261 | 2 | public function getMarkers() |
|
265 | |||
266 | /** |
||
267 | * Sets a series of markers contained in this file. |
||
268 | * |
||
269 | * @see getMarkers() for more information on markers. |
||
270 | */ |
||
271 | 2 | public function setMarkers(Collection $markers) |
|
275 | |||
276 | /** |
||
277 | * Returns a list of all errors in this file and all its child elements. |
||
278 | * |
||
279 | * @return Collection |
||
280 | */ |
||
281 | 2 | public function getAllErrors() |
|
333 | |||
334 | /** |
||
335 | * Sets the file path for this file relative to the project's root. |
||
336 | * |
||
337 | * @param string $path |
||
338 | */ |
||
339 | 1 | public function setPath($path) |
|
343 | |||
344 | /** |
||
345 | * Returns the file path relative to the project's root. |
||
346 | * |
||
347 | * @return string |
||
348 | */ |
||
349 | 1 | public function getPath() |
|
353 | } |
||
354 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: