1 | <?php |
||
21 | class AsyncClient |
||
22 | { |
||
23 | /** |
||
24 | * @var Client |
||
25 | */ |
||
26 | protected $client; |
||
27 | |||
28 | /** |
||
29 | * @param LoopInterface $loop |
||
30 | * @param string $token |
||
31 | * @param Client|null $client |
||
32 | */ |
||
33 | public function __construct(LoopInterface $loop, string $token = '', Client $client = null) |
||
41 | |||
42 | /** |
||
43 | * @param string $repository |
||
44 | * @return CancellablePromiseInterface |
||
45 | */ |
||
46 | public function repository(string $repository): CancellablePromiseInterface |
||
50 | |||
51 | /** |
||
52 | * @return ObservableInterface |
||
53 | */ |
||
54 | public function repositories(): ObservableInterface |
||
66 | |||
67 | /** |
||
68 | * @return PromiseInterface |
||
69 | */ |
||
70 | public function user(): PromiseInterface |
||
74 | |||
75 | /** |
||
76 | * @param int $id |
||
77 | * @return PromiseInterface |
||
78 | */ |
||
79 | public function sshKey(int $id): PromiseInterface |
||
83 | |||
84 | /** |
||
85 | * @return ObservableInterface |
||
86 | */ |
||
87 | public function hooks(): ObservableInterface |
||
93 | |||
94 | /** |
||
95 | * @return ObservableInterface |
||
96 | */ |
||
97 | public function accounts(): ObservableInterface |
||
103 | |||
104 | /** |
||
105 | * @return ObservableInterface |
||
106 | */ |
||
107 | public function broadcasts(): ObservableInterface |
||
113 | } |
||
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: