1 | <?php |
||
19 | class help extends \Threaded implements \Collectable |
||
20 | { |
||
21 | /** |
||
22 | * @var Message |
||
23 | */ |
||
24 | private $message; |
||
25 | /** |
||
26 | * @var Discord |
||
27 | */ |
||
28 | private $discord; |
||
29 | /** |
||
30 | * @var Logger |
||
31 | */ |
||
32 | private $log; |
||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | private $channelConfig; |
||
37 | /** |
||
38 | * @var Config |
||
39 | */ |
||
40 | private $config; |
||
41 | /** |
||
42 | * @var Db |
||
43 | */ |
||
44 | private $db; |
||
45 | /** |
||
46 | * @var cURL |
||
47 | */ |
||
48 | private $curl; |
||
49 | /** |
||
50 | * @var Settings |
||
51 | */ |
||
52 | private $settings; |
||
53 | /** |
||
54 | * @var Permissions |
||
55 | */ |
||
56 | private $permissions; |
||
57 | /** |
||
58 | * @var ServerConfig |
||
59 | */ |
||
60 | private $serverConfig; |
||
61 | /** |
||
62 | * @var Users |
||
63 | */ |
||
64 | private $users; |
||
65 | /** |
||
66 | * @var array |
||
67 | */ |
||
68 | private $onMessagePlugins; |
||
69 | private $onVoicePlugins; |
||
70 | |||
71 | public function __construct($message, $discord, $channelConfig, $log, $config, $db, $curl, $settings, $permissions, $serverConfig, $users, $extras) |
||
87 | |||
88 | /** |
||
89 | * |
||
90 | */ |
||
91 | public function run() |
||
114 | } |
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: