1 | <?php |
||
10 | class Signature extends Serializable implements SignatureInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var \GMP |
||
14 | */ |
||
15 | private $r; |
||
16 | |||
17 | /** |
||
18 | * @var \GMP |
||
19 | */ |
||
20 | private $s; |
||
21 | |||
22 | /** |
||
23 | * @var EcAdapter |
||
24 | */ |
||
25 | private $ecAdapter; |
||
26 | |||
27 | /** |
||
28 | * @var resource |
||
29 | */ |
||
30 | private $secp256k1_sig; |
||
31 | |||
32 | /** |
||
33 | * @param EcAdapter $adapter |
||
34 | * @param \GMP $r |
||
35 | * @param \GMP $s |
||
36 | * @param resource $secp256k1_ecdsa_signature_t |
||
37 | */ |
||
38 | 60 | public function __construct(EcAdapter $adapter, \GMP $r, \GMP $s, $secp256k1_ecdsa_signature_t) |
|
51 | |||
52 | /** |
||
53 | * @return \GMP |
||
54 | */ |
||
55 | 6 | public function getR() |
|
59 | |||
60 | /** |
||
61 | * @return \GMP |
||
62 | */ |
||
63 | 6 | public function getS() |
|
67 | |||
68 | /** |
||
69 | * @return resource |
||
70 | */ |
||
71 | 42 | public function getResource() |
|
75 | |||
76 | /** |
||
77 | * @param Signature $other |
||
78 | * @return bool |
||
79 | */ |
||
80 | private function doEquals(Signature $other) |
||
89 | |||
90 | /** |
||
91 | * @param SignatureInterface $signature |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function equals(SignatureInterface $signature) |
||
99 | |||
100 | /** |
||
101 | * @return \BitWasp\Buffertools\BufferInterface |
||
102 | */ |
||
103 | public function getBuffer() |
||
107 | } |
||
108 |
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: