1 | <?php |
||
23 | final class AsyncClient implements AsyncClientInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var ClientInterface |
||
27 | */ |
||
28 | private $client; |
||
29 | |||
30 | /** |
||
31 | * @param ClientInterface $client |
||
32 | */ |
||
33 | private function __construct(ClientInterface $client) |
||
37 | |||
38 | /** |
||
39 | * @param LoopInterface $loop |
||
40 | * @param array $options |
||
41 | * @return AsyncClient |
||
42 | */ |
||
43 | public static function create(string $host, LoopInterface $loop, array $options = []): self |
||
50 | |||
51 | /** |
||
52 | * @internal |
||
53 | * @param ClientInterface $client |
||
54 | * @return AsyncClient |
||
55 | */ |
||
56 | public static function createFromClient(ClientInterface $client): self |
||
60 | |||
61 | public function hydrate(string $resource): CancellablePromiseInterface |
||
65 | |||
66 | public function extract(ResourceInterface $resource): CancellablePromiseInterface |
||
70 | |||
71 | public function APIVersion(): CancellablePromiseInterface |
||
75 | |||
76 | public function version(): CancellablePromiseInterface |
||
80 | |||
81 | public function identification(): CancellablePromiseInterface |
||
85 | |||
86 | public function state(): CancellablePromiseInterface |
||
90 | |||
91 | public function pid(): CancellablePromiseInterface |
||
95 | |||
96 | public function restart(): CancellablePromiseInterface |
||
100 | |||
101 | public function shutdown(): CancellablePromiseInterface |
||
105 | |||
106 | public function programs(): Observable |
||
110 | } |
||
111 |
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: