1 | <?php declare(strict_types=1); |
||
18 | abstract class Commit extends AbstractResource implements CommitInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $sha; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $url; |
||
29 | |||
30 | /** |
||
31 | * @var User |
||
32 | */ |
||
33 | protected $author; |
||
34 | |||
35 | /** |
||
36 | * @var User |
||
37 | */ |
||
38 | protected $comitter; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $message; |
||
44 | |||
45 | /** |
||
46 | * @var Tree |
||
47 | */ |
||
48 | protected $tree; |
||
49 | |||
50 | /** |
||
51 | * @var int |
||
52 | */ |
||
53 | protected $comment_count; |
||
54 | |||
55 | /** |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $protection_url; |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | 4 | public function sha(): string |
|
67 | |||
68 | /** |
||
69 | * @return string |
||
70 | */ |
||
71 | 4 | public function url(): string |
|
75 | |||
76 | /** |
||
77 | * @return User |
||
78 | */ |
||
79 | public function author(): User |
||
83 | |||
84 | /** |
||
85 | * @return User |
||
86 | */ |
||
87 | public function comitter(): User |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | 4 | public function message(): string |
|
99 | |||
100 | /** |
||
101 | * @return TreeInterface |
||
102 | */ |
||
103 | public function tree(): TreeInterface |
||
107 | |||
108 | /** |
||
109 | * @return int |
||
110 | */ |
||
111 | 4 | public function commentCount(): int |
|
115 | |||
116 | /** |
||
117 | * @return string |
||
118 | */ |
||
119 | 4 | public function protectionUrl(): string |
|
123 | } |
||
124 |
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: