1 | <?php declare(strict_types=1); |
||
8 | abstract class EmptyCommit implements CommitInterface, EmptyResourceInterface |
||
9 | { |
||
10 | /** |
||
11 | * @return string |
||
12 | */ |
||
13 | 2 | public function sha(): string |
|
17 | |||
18 | /** |
||
19 | * @return string |
||
20 | */ |
||
21 | 2 | public function url(): string |
|
25 | |||
26 | /** |
||
27 | * @return User |
||
28 | */ |
||
29 | 2 | public function author(): User |
|
33 | |||
34 | /** |
||
35 | * @return User |
||
36 | */ |
||
37 | 2 | public function comitter(): User |
|
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | 2 | public function message(): string |
|
49 | |||
50 | /** |
||
51 | * @return TreeInterface |
||
52 | */ |
||
53 | 2 | public function tree(): TreeInterface |
|
57 | |||
58 | /** |
||
59 | * @return int |
||
60 | */ |
||
61 | 2 | public function commentCount(): int |
|
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | 2 | public function protectionUrl(): string |
|
73 | } |
||
74 |
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: