Skip to content

Commit 3f21361

Browse files
committed
autofix
1 parent 7cff8e2 commit 3f21361

23 files changed

+95
-43
lines changed

src/Internal/Assembler/TransferDtoAssembler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public function __construct(
1818
) {
1919
}
2020

21-
/** @param array<mixed>|null $extra */
21+
/**
22+
* @param array<mixed>|null $extra
23+
*/
2224
public function create(
2325
int $depositId,
2426
int $withdrawId,

src/Internal/Assembler/TransferDtoAssemblerInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
interface TransferDtoAssemblerInterface
1111
{
12-
/** @param array<mixed>|null $extra */
12+
/**
13+
* @param array<mixed>|null $extra
14+
*/
1315
public function create(
1416
int $depositId,
1517
int $withdrawId,

src/Internal/Assembler/TransferLazyDtoAssembler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
final class TransferLazyDtoAssembler implements TransferLazyDtoAssemblerInterface
1313
{
14-
/** @param array<mixed>|null $extra */
14+
/**
15+
* @param array<mixed>|null $extra
16+
*/
1517
public function create(
1618
Wallet $fromWallet,
1719
Wallet $toWallet,

src/Internal/Assembler/TransferLazyDtoAssemblerInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
interface TransferLazyDtoAssemblerInterface
1212
{
13-
/** @param array<mixed>|null $extra */
13+
/**
14+
* @param array<mixed>|null $extra
15+
*/
1416
public function create(
1517
Wallet $fromWallet,
1618
Wallet $toWallet,

src/Internal/Dto/TransferDto.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
/** @immutable */
1010
final readonly class TransferDto implements TransferDtoInterface
1111
{
12-
/** @param array<mixed>|null $extra */
12+
/**
13+
* @param array<mixed>|null $extra
14+
*/
1315
public function __construct(
1416
private string $uuid,
1517
private int $depositId,

src/Internal/Dto/TransferDtoInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public function getDiscount(): int;
2424

2525
public function getFee(): string;
2626

27-
/** @return array<mixed>|null */
27+
/**
28+
* @return array<mixed>|null
29+
*/
2830
public function getExtra(): ?array;
2931

3032
public function getCreatedAt(): DateTimeImmutable;

src/Internal/Dto/TransferLazyDtoInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public function getStatus(): string;
2424

2525
public function getUuid(): ?string;
2626

27-
/** @return array<mixed>|null */
27+
/**
28+
* @return array<mixed>|null
29+
*/
2830
public function getExtra(): ?array;
2931
}

src/Models/Wallet.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Bavix\Wallet\Internal\Service\MathServiceInterface;
1414
use Bavix\Wallet\Internal\Service\UuidFactoryServiceInterface;
1515
use Bavix\Wallet\Services\AtomicServiceInterface;
16-
use Bavix\Wallet\Services\CastServiceInterface;
1716
use Bavix\Wallet\Services\RegulatorServiceInterface;
1817
use Bavix\Wallet\Traits\CanConfirm;
1918
use Bavix\Wallet\Traits\CanExchange;
@@ -102,13 +101,16 @@ public function getTable(): string
102101
public function setNameAttribute(string $name): void
103102
{
104103
$this->attributes['name'] = $name;
105-
106104
/**
107105
* Must be updated only if the model does not exist or the slug is empty.
108106
*/
109-
if (! $this->exists && ! array_key_exists('slug', $this->attributes)) {
110-
$this->attributes['slug'] = Str::slug($name);
107+
if ($this->exists) {
108+
return;
109+
}
110+
if (array_key_exists('slug', $this->attributes)) {
111+
return;
111112
}
113+
$this->attributes['slug'] = Str::slug($name);
112114
}
113115

114116
/**

src/Objects/Cart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function getBasketDto(): BasketDtoInterface
175175
throw new CartEmptyException('Cart is empty', ExceptionInterface::CART_EMPTY);
176176
}
177177

178-
return new BasketDto($items, $this->getMeta(), $this->getExtra());
178+
return new BasketDto($items, $this->meta, $this->extra);
179179
}
180180

181181
private function productId(ProductInterface $product): string

src/Services/DiscountService.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ final class DiscountService implements DiscountServiceInterface
1515
{
1616
public function getDiscount(Wallet $customer, Wallet $product): int
1717
{
18-
if ($customer instanceof Customer && $product instanceof Discount) {
19-
return (int) $product->getPersonalDiscount($customer);
18+
if (! $customer instanceof Customer) {
19+
return 0;
2020
}
21-
22-
return 0;
21+
if (! $product instanceof Discount) {
22+
return 0;
23+
}
24+
return (int) $product->getPersonalDiscount($customer);
2325
}
2426
}

0 commit comments

Comments
 (0)