1 | <?php |
||
25 | final class AsyncClient implements AsyncClientInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var ClientInterface |
||
29 | */ |
||
30 | private $client; |
||
31 | |||
32 | /** |
||
33 | * @param ClientInterface $client |
||
34 | */ |
||
35 | private function __construct(ClientInterface $client) |
||
39 | |||
40 | /** |
||
41 | * @param LoopInterface $loop |
||
42 | * @param array $options |
||
43 | * @return AsyncClient |
||
44 | */ |
||
45 | public static function create(string $host, LoopInterface $loop, array $options = []): self |
||
52 | |||
53 | /** |
||
54 | * @internal |
||
55 | * @param ClientInterface $client |
||
56 | * @return AsyncClient |
||
57 | */ |
||
58 | public static function createFromClient(ClientInterface $client): self |
||
62 | |||
63 | public function hydrate(string $resource): CancellablePromiseInterface |
||
67 | |||
68 | public function extract(ResourceInterface $resource): CancellablePromiseInterface |
||
72 | |||
73 | public function APIVersion(): CancellablePromiseInterface |
||
77 | |||
78 | public function version(): CancellablePromiseInterface |
||
82 | |||
83 | public function identification(): CancellablePromiseInterface |
||
87 | |||
88 | public function state(): CancellablePromiseInterface |
||
92 | |||
93 | public function readLog(int $offset = 0, int $length = 0): CancellablePromiseInterface |
||
97 | |||
98 | public function clearLog(): CancellablePromiseInterface |
||
102 | |||
103 | public function pid(): CancellablePromiseInterface |
||
107 | |||
108 | public function restart(): CancellablePromiseInterface |
||
112 | |||
113 | public function shutdown(): CancellablePromiseInterface |
||
117 | |||
118 | public function programs(): Observable |
||
122 | } |
||
123 |
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: