Skip to content

Commit 599d23d

Browse files
committed
ecs rule update
1 parent 052f07a commit 599d23d

File tree

126 files changed

+667
-1359
lines changed

Some content is hidden

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

126 files changed

+667
-1359
lines changed

config/config.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,18 @@
4747
/**
4848
* Arbitrary Precision Calculator.
4949
*
50-
* 'scale' - length of the mantissa
50+
* 'scale' - length of the mantissa
5151
*/
52-
'math' => ['scale' => 64],
52+
'math' => [
53+
'scale' => 64,
54+
],
5355

5456
/**
5557
* Storage of the state of the balance of wallets.
5658
*/
57-
'cache' => ['driver' => 'array'],
59+
'cache' => [
60+
'driver' => 'array',
61+
],
5862

5963
/**
6064
* A system for dealing with race conditions.

database/2018_11_06_222923_create_transactions_table.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ public function up(): void
1818
$table->enum('type', ['deposit', 'withdraw'])->index();
1919
$table->decimal('amount', 64, 0);
2020
$table->boolean('confirmed');
21-
$table->json('meta')->nullable();
22-
$table->uuid('uuid')->unique();
21+
$table->json('meta')
22+
->nullable()
23+
;
24+
$table->uuid('uuid')
25+
->unique()
26+
;
2327
$table->timestamps();
2428

2529
$table->index(['payable_type', 'payable_id'], 'payable_type_payable_id_ind');

database/2018_11_07_192923_create_transfers_table.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ public function up(): void
1717
$table->morphs('from');
1818
$table->morphs('to');
1919
$table
20-
->enum(
21-
'status',
22-
['exchange', 'transfer', 'paid', 'refund', 'gift']
23-
)
20+
->enum('status', ['exchange', 'transfer', 'paid', 'refund', 'gift'])
2421
->default('transfer')
2522
;
2623

2724
$table
28-
->enum(
29-
'status_last',
30-
['exchange', 'transfer', 'paid', 'refund', 'gift']
31-
)
25+
->enum('status_last', ['exchange', 'transfer', 'paid', 'refund', 'gift'])
3226
->nullable()
3327
;
3428

@@ -43,7 +37,9 @@ public function up(): void
4337
->default(0)
4438
;
4539

46-
$table->uuid('uuid')->unique();
40+
$table->uuid('uuid')
41+
->unique()
42+
;
4743
$table->timestamps();
4844

4945
$table->foreign('deposit_id')

database/2018_11_15_124230_create_wallets_table.php

+18-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@ public function up(): void
1616
$table->bigIncrements('id');
1717
$table->morphs('holder');
1818
$table->string('name');
19-
$table->string('slug')->index();
20-
$table->uuid('uuid')->unique();
21-
$table->string('description')->nullable();
22-
$table->json('meta')->nullable();
23-
$table->decimal('balance', 64, 0)->default(0);
24-
$table->unsignedSmallInteger('decimal_places')->default(2);
19+
$table->string('slug')
20+
->index()
21+
;
22+
$table->uuid('uuid')
23+
->unique()
24+
;
25+
$table->string('description')
26+
->nullable()
27+
;
28+
$table->json('meta')
29+
->nullable()
30+
;
31+
$table->decimal('balance', 64, 0)
32+
->default(0)
33+
;
34+
$table->unsignedSmallInteger('decimal_places')
35+
->default(2)
36+
;
2537
$table->timestamps();
2638

2739
$table->unique(['holder_type', 'holder_id', 'slug']);

database/2021_11_02_202021_update_wallets_uuid_table.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ public function up(): void
3434
});
3535

3636
Schema::table($this->table(), static function (Blueprint $table) {
37-
$table->uuid('uuid')->change();
37+
$table->uuid('uuid')
38+
->change()
39+
;
3840
});
3941
}
4042

ecs.php

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
88
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
99
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
10+
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
1011
use Symplify\EasyCodingStandard\ValueObject\Option;
1112
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
1213

@@ -18,6 +19,7 @@
1819
]]);
1920

2021
$services->set(DeclareStrictTypesFixer::class);
22+
$services->set(LineLengthFixer::class);
2123

2224
$parameters = $containerConfigurator->parameters();
2325
$parameters->set(Option::PARALLEL, true);
@@ -35,6 +37,7 @@
3537
]);
3638

3739
$containerConfigurator->import(SetList::CLEAN_CODE);
40+
$containerConfigurator->import(SetList::SYMPLIFY);
3841
$containerConfigurator->import(SetList::PSR_12);
3942
$containerConfigurator->import(SetList::PHP_CS_FIXER);
4043
$containerConfigurator->import(SetList::CONTROL_STRUCTURES);

src/Interfaces/CartInterface.php

-4
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
namespace Bavix\Wallet\Interfaces;
66

77
use Bavix\Wallet\Internal\Dto\BasketDtoInterface;
8-
use Bavix\Wallet\Internal\Exceptions\CartEmptyException;
98

109
interface CartInterface
1110
{
12-
/**
13-
* @throws CartEmptyException
14-
*/
1511
public function getBasketDto(): BasketDtoInterface;
1612
}

src/Interfaces/Confirmable.php

-39
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,17 @@
44

55
namespace Bavix\Wallet\Interfaces;
66

7-
use Bavix\Wallet\Exceptions\BalanceIsEmpty;
8-
use Bavix\Wallet\Exceptions\ConfirmedInvalid;
9-
use Bavix\Wallet\Exceptions\InsufficientFunds;
10-
use Bavix\Wallet\Exceptions\UnconfirmedInvalid;
11-
use Bavix\Wallet\Exceptions\WalletOwnerInvalid;
12-
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
13-
use Bavix\Wallet\Internal\Exceptions\LockProviderNotFoundException;
14-
use Bavix\Wallet\Internal\Exceptions\RecordNotFoundException;
15-
use Bavix\Wallet\Internal\Exceptions\TransactionFailedException;
167
use Bavix\Wallet\Models\Transaction;
17-
use Illuminate\Database\RecordsNotFoundException;
188

199
interface Confirmable
2010
{
21-
/**
22-
* @throws BalanceIsEmpty
23-
* @throws InsufficientFunds
24-
* @throws ConfirmedInvalid
25-
* @throws WalletOwnerInvalid
26-
* @throws LockProviderNotFoundException
27-
* @throws RecordNotFoundException
28-
* @throws RecordsNotFoundException
29-
* @throws TransactionFailedException
30-
* @throws ExceptionInterface
31-
*/
3211
public function confirm(Transaction $transaction): bool;
3312

3413
public function safeConfirm(Transaction $transaction): bool;
3514

36-
/**
37-
* @throws UnconfirmedInvalid
38-
* @throws WalletOwnerInvalid
39-
* @throws LockProviderNotFoundException
40-
* @throws RecordNotFoundException
41-
* @throws RecordsNotFoundException
42-
* @throws TransactionFailedException
43-
* @throws ExceptionInterface
44-
*/
4515
public function resetConfirm(Transaction $transaction): bool;
4616

4717
public function safeResetConfirm(Transaction $transaction): bool;
4818

49-
/**
50-
* @throws ConfirmedInvalid
51-
* @throws WalletOwnerInvalid
52-
* @throws LockProviderNotFoundException
53-
* @throws RecordNotFoundException
54-
* @throws RecordsNotFoundException
55-
* @throws TransactionFailedException
56-
* @throws ExceptionInterface
57-
*/
5819
public function forceConfirm(Transaction $transaction): bool;
5920
}

src/Interfaces/Customer.php

-134
Original file line numberDiff line numberDiff line change
@@ -4,113 +4,31 @@
44

55
namespace Bavix\Wallet\Interfaces;
66

7-
use Bavix\Wallet\Exceptions\BalanceIsEmpty;
8-
use Bavix\Wallet\Exceptions\InsufficientFunds;
9-
use Bavix\Wallet\Exceptions\ProductEnded;
10-
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
11-
use Bavix\Wallet\Internal\Exceptions\LockProviderNotFoundException;
12-
use Bavix\Wallet\Internal\Exceptions\ModelNotFoundException;
13-
use Bavix\Wallet\Internal\Exceptions\RecordNotFoundException;
14-
use Bavix\Wallet\Internal\Exceptions\TransactionFailedException;
157
use Bavix\Wallet\Models\Transfer;
16-
use Illuminate\Database\RecordsNotFoundException;
178

189
interface Customer extends Wallet
1910
{
20-
/**
21-
* @throws ProductEnded
22-
* @throws BalanceIsEmpty
23-
* @throws InsufficientFunds
24-
* @throws LockProviderNotFoundException
25-
* @throws RecordNotFoundException
26-
* @throws RecordsNotFoundException
27-
* @throws TransactionFailedException
28-
* @throws ExceptionInterface
29-
*/
3011
public function payFree(Product $product): Transfer;
3112

3213
public function safePay(Product $product, bool $force = false): ?Transfer;
3314

34-
/**
35-
* @throws ProductEnded
36-
* @throws BalanceIsEmpty
37-
* @throws InsufficientFunds
38-
* @throws LockProviderNotFoundException
39-
* @throws RecordNotFoundException
40-
* @throws RecordsNotFoundException
41-
* @throws TransactionFailedException
42-
* @throws ExceptionInterface
43-
*/
4415
public function pay(Product $product, bool $force = false): Transfer;
4516

46-
/**
47-
* @throws ProductEnded
48-
* @throws LockProviderNotFoundException
49-
* @throws RecordNotFoundException
50-
* @throws RecordsNotFoundException
51-
* @throws TransactionFailedException
52-
* @throws ExceptionInterface
53-
*/
5417
public function forcePay(Product $product): Transfer;
5518

5619
public function safeRefund(Product $product, bool $force = false, bool $gifts = false): bool;
5720

58-
/**
59-
* @throws BalanceIsEmpty
60-
* @throws InsufficientFunds
61-
* @throws LockProviderNotFoundException
62-
* @throws RecordNotFoundException
63-
* @throws RecordsNotFoundException
64-
* @throws TransactionFailedException
65-
* @throws ModelNotFoundException
66-
* @throws ExceptionInterface
67-
*/
6821
public function refund(Product $product, bool $force = false, bool $gifts = false): bool;
6922

70-
/**
71-
* @throws LockProviderNotFoundException
72-
* @throws RecordNotFoundException
73-
* @throws RecordsNotFoundException
74-
* @throws TransactionFailedException
75-
* @throws ModelNotFoundException
76-
* @throws ExceptionInterface
77-
*/
7823
public function forceRefund(Product $product, bool $gifts = false): bool;
7924

8025
public function safeRefundGift(Product $product, bool $force = false): bool;
8126

82-
/**
83-
* @throws BalanceIsEmpty
84-
* @throws InsufficientFunds
85-
* @throws LockProviderNotFoundException
86-
* @throws RecordNotFoundException
87-
* @throws RecordsNotFoundException
88-
* @throws TransactionFailedException
89-
* @throws ModelNotFoundException
90-
* @throws ExceptionInterface
91-
*/
9227
public function refundGift(Product $product, bool $force = false): bool;
9328

94-
/**
95-
* @throws LockProviderNotFoundException
96-
* @throws RecordNotFoundException
97-
* @throws RecordsNotFoundException
98-
* @throws TransactionFailedException
99-
* @throws ModelNotFoundException
100-
* @throws ExceptionInterface
101-
*/
10229
public function forceRefundGift(Product $product): bool;
10330

10431
/**
105-
* @throws ProductEnded
106-
* @throws BalanceIsEmpty
107-
* @throws InsufficientFunds
108-
* @throws LockProviderNotFoundException
109-
* @throws RecordNotFoundException
110-
* @throws RecordsNotFoundException
111-
* @throws TransactionFailedException
112-
* @throws ExceptionInterface
113-
*
11432
* @return non-empty-array<Transfer>
11533
*/
11634
public function payFreeCart(CartInterface $cart): array;
@@ -119,77 +37,25 @@ public function payFreeCart(CartInterface $cart): array;
11937
public function safePayCart(CartInterface $cart, bool $force = false): array;
12038

12139
/**
122-
* @throws ProductEnded
123-
* @throws BalanceIsEmpty
124-
* @throws InsufficientFunds
125-
* @throws LockProviderNotFoundException
126-
* @throws RecordNotFoundException
127-
* @throws RecordsNotFoundException
128-
* @throws TransactionFailedException
129-
* @throws ExceptionInterface
130-
*
13140
* @return non-empty-array<Transfer>
13241
*/
13342
public function payCart(CartInterface $cart, bool $force = false): array;
13443

13544
/**
136-
* @throws ProductEnded
137-
* @throws LockProviderNotFoundException
138-
* @throws RecordNotFoundException
139-
* @throws RecordsNotFoundException
140-
* @throws TransactionFailedException
141-
* @throws ExceptionInterface
142-
*
14345
* @return non-empty-array<Transfer>
14446
*/
14547
public function forcePayCart(CartInterface $cart): array;
14648

14749
public function safeRefundCart(CartInterface $cart, bool $force = false, bool $gifts = false): bool;
14850

149-
/**
150-
* @throws BalanceIsEmpty
151-
* @throws InsufficientFunds
152-
* @throws LockProviderNotFoundException
153-
* @throws RecordNotFoundException
154-
* @throws RecordsNotFoundException
155-
* @throws TransactionFailedException
156-
* @throws ModelNotFoundException
157-
* @throws ExceptionInterface
158-
*/
15951
public function refundCart(CartInterface $cart, bool $force = false, bool $gifts = false): bool;
16052

161-
/**
162-
* @throws LockProviderNotFoundException
163-
* @throws RecordNotFoundException
164-
* @throws RecordsNotFoundException
165-
* @throws TransactionFailedException
166-
* @throws ModelNotFoundException
167-
* @throws ExceptionInterface
168-
*/
16953
public function forceRefundCart(CartInterface $cart, bool $gifts = false): bool;
17054

17155
public function safeRefundGiftCart(CartInterface $cart, bool $force = false): bool;
17256

173-
/**
174-
* @throws BalanceIsEmpty
175-
* @throws InsufficientFunds
176-
* @throws LockProviderNotFoundException
177-
* @throws RecordNotFoundException
178-
* @throws RecordsNotFoundException
179-
* @throws TransactionFailedException
180-
* @throws ModelNotFoundException
181-
* @throws ExceptionInterface
182-
*/
18357
public function refundGiftCart(CartInterface $cart, bool $force = false): bool;
18458

185-
/**
186-
* @throws LockProviderNotFoundException
187-
* @throws RecordNotFoundException
188-
* @throws RecordsNotFoundException
189-
* @throws TransactionFailedException
190-
* @throws ModelNotFoundException
191-
* @throws ExceptionInterface
192-
*/
19359
public function forceRefundGiftCart(CartInterface $cart): bool;
19460

19561
public function paid(Product $product, bool $gifts = false): ?Transfer;

0 commit comments

Comments
 (0)