Skip to content

Commit 0964beb

Browse files
author
Brian Faust
committed
chore: set up graham-campbell/analyzer
1 parent 56e5536 commit 0964beb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+154
-113
lines changed

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@
99
"currency"
1010
],
1111
"license": "MIT",
12-
"authors": [{
13-
"name": "Brian Faust",
14-
"email": "[email protected]",
15-
"homepage": "https://github.com/faustbrian"
16-
}],
12+
"authors": [
13+
{
14+
"name": "Brian Faust",
15+
"email": "[email protected]",
16+
"homepage": "https://github.com/faustbrian"
17+
}
18+
],
1719
"require": {
1820
"php": "^7.2",
1921
"bitwasp/bitcoin": "^1.0",
20-
"kodekeep/bytebuffer": "^1.0",
21-
"kodekeep/binary": "^1.0"
22+
"kodekeep/binary": "^1.0",
23+
"kodekeep/bytebuffer": "^1.0"
2224
},
2325
"require-dev": {
2426
"friendsofphp/php-cs-fixer": "^2.16",
27+
"graham-campbell/analyzer": "^3.0",
2528
"illuminate/support": "^7.0.0",
2629
"mockery/mockery": "^1.2",
2730
"pestphp/drift": "^0.3.0",

phpunit.xml.dist

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
verbose="true"
1717
>
1818
<testsuites>
19-
<testsuite name="Ark PHP Crypto Test Suite">
20-
<directory suffix="Test.php">./tests</directory>
19+
<testsuite name="Analysis">
20+
<directory suffix="Test.php">./tests/Analysis</directory>
21+
</testsuite>
22+
<testsuite name="Unit">
23+
<directory suffix="Test.php">./tests/Unit</directory>
2124
</testsuite>
2225
</testsuites>
2326
<filter>

src/Identities/Address.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Address
3434
/**
3535
* Derive the address from the given passphrase.
3636
*
37-
* @param string $passphrase
38-
* @param \ArkEcosystem\Crypto\Networks\AbstractNetwork|null $network
37+
* @param string $passphrase
38+
* @param AbstractNetwork|null $network
3939
*
4040
* @return string
4141
*/
@@ -47,8 +47,8 @@ public static function fromPassphrase(string $passphrase, AbstractNetwork $netwo
4747
/**
4848
* Derive the address from the given public key.
4949
*
50-
* @param string $publicKey
51-
* @param \ArkEcosystem\Crypto\Networks\AbstractNetwork|null $network
50+
* @param string $publicKey
51+
* @param AbstractNetwork|null $network
5252
*
5353
* @return string
5454
*/
@@ -66,7 +66,7 @@ public static function fromPublicKey(string $publicKey, $network = null): string
6666
* Derive the address from the given private key.
6767
*
6868
* @param \BitWasp\Bitcoin\Crypto\EcAdapter\Impl\PhpEcc\Key\PrivateKey $privateKey
69-
* @param ArkEcosystem\Crypto\Networks\AbstractNetwork|null $network
69+
* @param AbstractNetwork|null $network
7070
*
7171
* @return string
7272
*/
@@ -80,8 +80,8 @@ public static function fromPrivateKey(EccPrivateKey $privateKey, AbstractNetwork
8080
/**
8181
* Validate the given address.
8282
*
83-
* @param string $address
84-
* @param \ArkEcosystem\Crypto\Networks\AbstractNetwork|int|null $network
83+
* @param string $address
84+
* @param AbstractNetwork|int|null $network
8585
*
8686
* @return bool
8787
*/

src/Transactions/Builder/DelegateRegistrationBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct()
3838
*
3939
* @param string $username
4040
*
41-
* @return \ArkEcosystem\Crypto\Transactions\Builder\DelegateRegistration
41+
* @return self
4242
*/
4343
public function username(string $username): self
4444
{
@@ -52,7 +52,7 @@ public function username(string $username): self
5252
*
5353
* @param string $passphrase
5454
*
55-
* @return \ArkEcosystem\Crypto\Transactions\Builder\AbstractTransactionBuilder
55+
* @return self
5656
*/
5757
public function sign(string $passphrase): AbstractTransactionBuilder
5858
{

src/Transactions/Builder/MultiPaymentBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct()
3838
* @param string $recipientId
3939
* @param string $amount
4040
*
41-
* @return \ArkEcosystem\Crypto\Transactions\Builder\MultiPayment
41+
* @return self
4242
*/
4343
public function add(string $recipientId, string $amount): self
4444
{
@@ -52,7 +52,7 @@ public function add(string $recipientId, string $amount): self
5252
*
5353
* @param string $vendorField
5454
*
55-
* @return \ArkEcosystem\Crypto\Transactions\Builder\MultiPayment
55+
* @return self
5656
*/
5757
public function vendorField(string $vendorField): self
5858
{

src/Transactions/Builder/MultiSignatureRegistrationBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct()
4040
*
4141
* @param int $min
4242
*
43-
* @return \ArkEcosystem\Crypto\Transactions\Builder\MultiSignatureRegistration
43+
* @return self
4444
*/
4545
public function min(int $min): self
4646
{
@@ -54,7 +54,7 @@ public function min(int $min): self
5454
*
5555
* @param int $lifetime
5656
*
57-
* @return \ArkEcosystem\Crypto\Transactions\Builder\MultiSignatureRegistration
57+
* @return self
5858
*/
5959
public function lifetime(int $lifetime): self
6060
{
@@ -68,7 +68,7 @@ public function lifetime(int $lifetime): self
6868
*
6969
* @param array $keysgroup
7070
*
71-
* @return \ArkEcosystem\Crypto\Transactions\Builder\MultiSignatureRegistration
71+
* @return self
7272
*/
7373
public function keysgroup(array $keysgroup): self
7474
{

src/Transactions/Builder/SecondSignatureRegistrationBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SecondSignatureRegistrationBuilder extends AbstractTransactionBuilder
2828
*
2929
* @param string $secondPassphrase
3030
*
31-
* @return \ArkEcosystem\Crypto\Transactions\Builder\SecondSignatureRegistration
31+
* @return self
3232
*/
3333
public function signature(string $secondPassphrase): self
3434
{

src/Transactions/Builder/TransferBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct()
3434
*
3535
* @param string $recipientId
3636
*
37-
* @return \ArkEcosystem\Crypto\Transactions\Builder\Transfer
37+
* @return self
3838
*/
3939
public function recipient(string $recipientId): self
4040
{
@@ -48,7 +48,7 @@ public function recipient(string $recipientId): self
4848
*
4949
* @param string $amount
5050
*
51-
* @return \ArkEcosystem\Crypto\Transactions\Builder\Transfer
51+
* @return self
5252
*/
5353
public function amount(string $amount): self
5454
{
@@ -62,7 +62,7 @@ public function amount(string $amount): self
6262
*
6363
* @param string $vendorField
6464
*
65-
* @return \ArkEcosystem\Crypto\Transactions\Builder\Transfer
65+
* @return self
6666
*/
6767
public function vendorField(string $vendorField): self
6868
{

src/Transactions/Builder/VoteBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct()
3939
*
4040
* @param array $votes
4141
*
42-
* @return \ArkEcosystem\Crypto\Transactions\Builder\Vote
42+
* @return self
4343
*/
4444
public function votes(array $votes): self
4545
{
@@ -53,7 +53,7 @@ public function votes(array $votes): self
5353
*
5454
* @param string $passphrase
5555
*
56-
* @return \ArkEcosystem\Crypto\Transactions\Builder\AbstractTransactionBuilder
56+
* @return self
5757
*/
5858
public function sign(string $passphrase): AbstractTransactionBuilder
5959
{

src/Transactions/Deserializer.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace ArkEcosystem\Crypto\Transactions;
1515

16-
use ArkEcosystem\Crypto\Transactions\Types as Transactions;
16+
use ArkEcosystem\Crypto\Transactions\Types\Transaction;
1717
use BitWasp\Bitcoin\Crypto\Hash;
1818
use KodeKeep\ByteBuffer\ByteBuffer;
1919

@@ -30,17 +30,17 @@ class Deserializer
3030
* @var array
3131
*/
3232
private $transactionsClasses = [
33-
Transactions\Transfer::class,
34-
Transactions\SecondSignatureRegistration::class,
35-
Transactions\DelegateRegistration::class,
36-
Transactions\Vote::class,
37-
Transactions\MultiSignatureRegistration::class,
38-
Transactions\IPFS::class,
39-
Transactions\MultiPayment::class,
40-
Transactions\DelegateResignation::class,
41-
Transactions\HtlcLock::class,
42-
Transactions\HtlcClaim::class,
43-
Transactions\HtlcRefund::class,
33+
Types\Transfer::class,
34+
Types\SecondSignatureRegistration::class,
35+
Types\DelegateRegistration::class,
36+
Types\Vote::class,
37+
Types\MultiSignatureRegistration::class,
38+
Types\IPFS::class,
39+
Types\MultiPayment::class,
40+
Types\DelegateResignation::class,
41+
Types\HtlcLock::class,
42+
Types\HtlcClaim::class,
43+
Types\HtlcRefund::class,
4444
];
4545

4646
/**
@@ -68,9 +68,9 @@ public static function new(string $serialized)
6868
/**
6969
* Perform AIP11 compliant deserialization.
7070
*
71-
* @return \ArkEcosystem\Crypto\Transactions\Transaction
71+
* @return Transaction
7272
*/
73-
public function deserialize(): Transactions\Transaction
73+
public function deserialize(): Transaction
7474
{
7575
$data = [];
7676

@@ -108,7 +108,7 @@ private function deserializeCommon(array &$data): void
108108
$data['fee'] = strval($this->buffer->readUInt64());
109109
}
110110

111-
private function deserializeVendorField(Transactions\Transaction $transaction): void
111+
private function deserializeVendorField(Transaction $transaction): void
112112
{
113113
$vendorFieldLength = $this->buffer->readUInt8();
114114
if ($vendorFieldLength > 0) {
@@ -264,11 +264,11 @@ private function detectSchnorr(): bool
264264
/**
265265
* Handle the deserialization of transaction data with a version of 2.0.
266266
*
267-
* @param \ArkEcosystem\Crypto\Transaction $transaction
267+
* @param Transaction $transaction
268268
*
269-
* @return \ArkEcosystem\Crypto\Transactions\Transaction
269+
* @return Transaction
270270
*/
271-
public function handleVersionTwo(Transactions\Transaction $transaction): Transactions\Transaction
271+
public function handleVersionTwo(Transaction $transaction): Transaction
272272
{
273273
$transaction->data['id'] = Hash::sha256(Serializer::new($transaction)->serialize())->getHex();
274274

0 commit comments

Comments
 (0)