1 | <?php |
||
13 | class Signature extends Serializable implements SignatureInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var \GMP |
||
17 | */ |
||
18 | private $r; |
||
19 | |||
20 | /** |
||
21 | * @var \GMP |
||
22 | */ |
||
23 | private $s; |
||
24 | |||
25 | /** |
||
26 | * @var EcAdapter |
||
27 | */ |
||
28 | private $ecAdapter; |
||
29 | |||
30 | /** |
||
31 | * @var resource |
||
32 | */ |
||
33 | private $secp256k1_sig; |
||
34 | |||
35 | /** |
||
36 | * @param EcAdapter $adapter |
||
37 | * @param \GMP $r |
||
38 | * @param \GMP $s |
||
39 | * @param resource $secp256k1_ecdsa_signature_t |
||
40 | */ |
||
41 | 207 | public function __construct(EcAdapter $adapter, \GMP $r, \GMP $s, $secp256k1_ecdsa_signature_t) |
|
54 | |||
55 | /** |
||
56 | * @return \GMP |
||
57 | */ |
||
58 | 3 | public function getR() |
|
62 | |||
63 | /** |
||
64 | * @return \GMP |
||
65 | */ |
||
66 | 3 | public function getS() |
|
70 | |||
71 | /** |
||
72 | * @return resource |
||
73 | */ |
||
74 | 191 | public function getResource() |
|
78 | |||
79 | /** |
||
80 | * @param Signature $other |
||
81 | * @return bool |
||
82 | */ |
||
83 | 53 | private function doEquals(Signature $other): bool |
|
92 | |||
93 | /** |
||
94 | * @param SignatureInterface $signature |
||
95 | * @return bool |
||
96 | */ |
||
97 | 53 | public function equals(SignatureInterface $signature): bool |
|
102 | |||
103 | /** |
||
104 | * @return BufferInterface |
||
105 | */ |
||
106 | public function getBuffer(): BufferInterface |
||
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: