Skip to content

Commit e95ffa3

Browse files
committed
fix union types
1 parent fc14b5f commit e95ffa3

13 files changed

+23
-76
lines changed

src/Services/BookkeeperService.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,16 @@ public function amount(Wallet $wallet): string
4141
return $this->storageService->get($this->getKey($wallet));
4242
}
4343

44-
public function sync(Wallet $wallet, $value): bool
44+
public function sync(Wallet $wallet, float|int|string $value): bool
4545
{
4646
return $this->storageService->sync($this->getKey($wallet), $value);
4747
}
4848

4949
/**
50-
* @param float|int|string $value
51-
*
5250
* @throws LockProviderNotFoundException
5351
* @throws RecordNotFoundException
5452
*/
55-
public function increase(Wallet $wallet, $value): string
53+
public function increase(Wallet $wallet, float|int|string $value): string
5654
{
5755
try {
5856
return $this->storageService->increase($this->getKey($wallet), $value);

src/Services/BookkeeperServiceInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@ public function missing(Wallet $wallet): bool;
1515
public function amount(Wallet $wallet): string;
1616

1717
/**
18-
* @param float|int|string $value
19-
*
2018
* @throws LockProviderNotFoundException
2119
* @throws RecordNotFoundException
2220
*/
23-
public function sync(Wallet $wallet, $value): bool;
21+
public function sync(Wallet $wallet, float|int|string $value): bool;
2422

2523
/**
26-
* @param float|int|string $value
27-
*
2824
* @throws LockProviderNotFoundException
2925
* @throws RecordNotFoundException
3026
*/
31-
public function increase(Wallet $wallet, $value): string;
27+
public function increase(Wallet $wallet, float|int|string $value): string;
3228
}

src/Services/CastService.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ public function getWallet(Wallet $object, bool $save = true): WalletModel
4545
return $wallet;
4646
}
4747

48-
/**
49-
* @param Model|Wallet $object
50-
*/
51-
public function getHolder($object): Model
48+
public function getHolder(Model|Wallet $object): Model
5249
{
5350
return $this->getModel($object instanceof WalletModel ? $object->holder : $object);
5451
}

src/Services/CastServiceInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ interface CastServiceInterface
1212
{
1313
public function getWallet(Wallet $object, bool $save = true): WalletModel;
1414

15-
/**
16-
* @param Model|Wallet $object
17-
*/
18-
public function getHolder($object): Model;
15+
public function getHolder(Model|Wallet $object): Model;
1916

2017
public function getModel(object $object): Model;
2118
}

src/Services/ConsistencyService.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ public function __construct(
2323
}
2424

2525
/**
26-
* @param float|int|string $amount
27-
*
2826
* @throws AmountInvalid
2927
*/
30-
public function checkPositive($amount): void
28+
public function checkPositive(float|int|string $amount): void
3129
{
3230
if ($this->mathService->compare($amount, 0) === -1) {
3331
throw new AmountInvalid(
@@ -38,12 +36,10 @@ public function checkPositive($amount): void
3836
}
3937

4038
/**
41-
* @param float|int|string $amount
42-
*
4339
* @throws BalanceIsEmpty
4440
* @throws InsufficientFunds
4541
*/
46-
public function checkPotential(Wallet $object, $amount, bool $allowZero = false): void
42+
public function checkPotential(Wallet $object, float|int|string $amount, bool $allowZero = false): void
4743
{
4844
$wallet = $this->castService->getWallet($object, false);
4945
$balance = $this->mathService->add($wallet->getBalanceAttribute(), $wallet->getCreditAttribute());
@@ -63,11 +59,7 @@ public function checkPotential(Wallet $object, $amount, bool $allowZero = false)
6359
}
6460
}
6561

66-
/**
67-
* @param float|int|string $balance
68-
* @param float|int|string $amount
69-
*/
70-
public function canWithdraw($balance, $amount, bool $allowZero = false): bool
62+
public function canWithdraw(float|int|string $balance, float|int|string $amount, bool $allowZero = false): bool
7163
{
7264
$mathService = app(MathServiceInterface::class);
7365

src/Services/ConsistencyServiceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function checkPositive(float|int|string $amount): void;
2323
*/
2424
public function checkPotential(Wallet $object, float|int|string $amount, bool $allowZero = false): void;
2525

26-
public function canWithdraw(int|string $balance, int|string $amount, bool $allowZero = false): bool;
26+
public function canWithdraw(float|int|string $balance, float|int|string $amount, bool $allowZero = false): bool;
2727

2828
/**
2929
* @param TransferLazyDtoInterface[] $objects

src/Services/ExchangeService.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
final class ExchangeService implements ExchangeServiceInterface
88
{
9-
/**
10-
* @param float|int|string $amount
11-
*/
12-
public function convertTo(string $fromCurrency, string $toCurrency, $amount): string
9+
public function convertTo(string $fromCurrency, string $toCurrency, float|int|string $amount): string
1310
{
1411
return (string) $amount;
1512
}

src/Services/ExchangeServiceInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@
66

77
interface ExchangeServiceInterface
88
{
9-
/**
10-
* @param float|int|string $amount
11-
*/
12-
public function convertTo(string $fromCurrency, string $toCurrency, $amount): string;
9+
public function convertTo(string $fromCurrency, string $toCurrency, float|int|string $amount): string;
1310
}

src/Services/RegulatorService.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ public function amount(Wallet $wallet): string
5555
);
5656
}
5757

58-
/**
59-
* @param float|int|string $value
60-
*/
61-
public function sync(Wallet $wallet, $value): bool
58+
public function sync(Wallet $wallet, float|int|string $value): bool
6259
{
6360
$this->persist($wallet);
6461

@@ -70,10 +67,7 @@ public function sync(Wallet $wallet, $value): bool
7067
);
7168
}
7269

73-
/**
74-
* @param float|int|string $value
75-
*/
76-
public function increase(Wallet $wallet, $value): string
70+
public function increase(Wallet $wallet, float|int|string $value): string
7771
{
7872
$this->persist($wallet);
7973

@@ -87,10 +81,7 @@ public function increase(Wallet $wallet, $value): string
8781
return $this->amount($wallet);
8882
}
8983

90-
/**
91-
* @param float|int|string $value
92-
*/
93-
public function decrease(Wallet $wallet, $value): string
84+
public function decrease(Wallet $wallet, float|int|string $value): string
9485
{
9586
return $this->increase($wallet, $this->mathService->negative($value));
9687
}

src/Services/RegulatorServiceInterface.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,11 @@ public function diff(Wallet $wallet): string;
1414

1515
public function amount(Wallet $wallet): string;
1616

17-
/**
18-
* @param float|int|string $value
19-
*/
20-
public function sync(Wallet $wallet, $value): bool;
21-
22-
/**
23-
* @param float|int|string $value
24-
*/
25-
public function increase(Wallet $wallet, $value): string;
26-
27-
/**
28-
* @param float|int|string $value
29-
*/
30-
public function decrease(Wallet $wallet, $value): string;
17+
public function sync(Wallet $wallet, float|int|string $value): bool;
18+
19+
public function increase(Wallet $wallet, float|int|string $value): string;
20+
21+
public function decrease(Wallet $wallet, float|int|string $value): string;
3122

3223
public function approve(): void;
3324

0 commit comments

Comments
 (0)