1 | <?php namespace Mascame\Artificer\Extension; |
||
10 | class Manager extends \Mascame\Extender\Manager { |
||
11 | |||
12 | /** |
||
13 | * @var \Mascame\Artificer\Plugin\Manager|\Mascame\Artificer\Widget\Manager |
||
14 | */ |
||
15 | protected $manager; |
||
16 | |||
17 | /** |
||
18 | * Composer packages |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $packages = []; |
||
23 | |||
24 | /** |
||
25 | * @param InstallerInterface $installer |
||
26 | * @param BooterInterface|null $booter |
||
27 | * @param EventInterface|null $eventDispatcher |
||
28 | * @throws \Exception |
||
29 | */ |
||
30 | public function __construct( |
||
40 | |||
41 | /** |
||
42 | * @param $name |
||
43 | * @param \Closure $plugin |
||
44 | */ |
||
45 | public function add($name, \Closure $plugin) |
||
53 | |||
54 | /** |
||
55 | * vendor/package |
||
56 | * |
||
57 | * @param $namespace |
||
58 | * @return bool |
||
59 | */ |
||
60 | protected function isValidNamespace($namespace) { |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | protected function getPackagesVersions() { |
||
87 | |||
88 | /** |
||
89 | * @param $namespace |
||
90 | * @return mixed |
||
91 | * @throws \Exception |
||
92 | */ |
||
93 | public function getVersion($namespace) { |
||
100 | } |
||
101 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: