Conditions | 1 |
Paths | 1 |
Total Lines | 33 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
83 | public function run() |
||
84 | { |
||
85 | $choices = array( |
||
86 | 'It is certain', |
||
87 | 'It is decidedly so', |
||
88 | 'Without a doubt', |
||
89 | 'Yes, definitely', |
||
90 | 'You may rely on it', |
||
91 | 'As I see it, yes', |
||
92 | 'Most likely', |
||
93 | 'More than likely', |
||
94 | 'Outlook good', |
||
95 | 'Yes', |
||
96 | 'No', |
||
97 | 'Lol no', |
||
98 | 'Signs point to, yes', |
||
99 | 'Reply hazy, try again', |
||
100 | 'Ask again later', |
||
101 | 'I Better not tell you now', |
||
102 | 'I Cannot predict now', |
||
103 | 'Concentrate and ask again', |
||
104 | 'Don\'t count on it', |
||
105 | 'My reply is no', |
||
106 | 'My sources say no', |
||
107 | 'Outlook not so good', |
||
108 | 'Very doubtful', |
||
109 | ); |
||
110 | |||
111 | $this->message->reply($choices[array_rand($choices)]); |
||
112 | |||
113 | // Mark this as garbage |
||
114 | $this->isGarbage(); |
||
115 | } |
||
116 | } |
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: