1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace Innmind\AMQP\Transport; |
||
5 | |||
6 | use Innmind\AMQP\Transport\{ |
||
7 | Frame\Method, |
||
8 | Protocol\Version, |
||
9 | Protocol\Connection, |
||
0 ignored issues
–
show
|
|||
10 | Protocol\Channel, |
||
11 | Protocol\Exchange, |
||
12 | Protocol\Queue, |
||
13 | Protocol\Basic, |
||
14 | Protocol\Transaction, |
||
15 | }; |
||
16 | use Innmind\Stream\Readable; |
||
17 | use Innmind\Immutable\StreamInterface; |
||
18 | |||
19 | interface Protocol |
||
20 | { |
||
21 | public function version(): Version; |
||
22 | public function use(Version $version): self; |
||
23 | |||
24 | /** |
||
25 | * @return StreamInterface<Value> |
||
26 | */ |
||
27 | public function read(Method $method, Readable $arguments): StreamInterface; |
||
28 | |||
29 | /** |
||
30 | * @return StreamInterface<Value> |
||
31 | */ |
||
32 | public function readHeader(Readable $arguments): StreamInterface; |
||
33 | public function method(string $name): Method; |
||
34 | public function connection(): Connection; |
||
35 | public function channel(): Channel; |
||
36 | public function exchange(): Exchange; |
||
37 | public function queue(): Queue; |
||
38 | public function basic(): Basic; |
||
39 | public function transaction(): Transaction; |
||
40 | } |
||
41 |
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: