Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phpunits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
php-versions: [8.3, 8.4]
php-versions: [8.3, 8.4, 8.5]
databases: [testing, pgsql, mysql, mariadb]
caches: [array, redis, memcached, database]
locks: [redis, memcached]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ laravel-wallet - It's easy to work with a virtual wallet.

| Version | Laravel | PHP | Release date | End of improvements | End of support |
|------------|----------------|-----------------|--------------|---------------------|----------------|
| 11.x [LTS] | ^11.0, ^12.0 | 8.2,8.3,8.4 | Mar 14, 2024 | May 1, 2026 | Sep 6, 2026 |
| 11.x [LTS] | ^11.0, ^12.0 | 8.3,8.4,8.5 | Mar 14, 2024 | May 1, 2026 | Sep 6, 2026 |

### Upgrade Guide

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"php": "^8.2",
"php": "^8.3",
"ext-json": "*",
"ext-pdo": "*",
"brick/math": "~0.10",
Expand All @@ -41,7 +41,7 @@
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.0",
"rector/rector": "^2.0",
"symplify/easy-coding-standard": "^12.1"
"symplify/easy-coding-standard": "^13.0"
},
"suggest": {
"bavix/laravel-wallet-swap": "Addition to the laravel-wallet library for quick setting of exchange rates",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
$config->import(SetList::INSTANCEOF);
$config->import(SetList::CODE_QUALITY);
$config->import(SetList::DEAD_CODE);
$config->import(SetList::PHP_82);
$config->import(SetList::PHP_83);
};
2 changes: 1 addition & 1 deletion src/Internal/Assembler/ExtraDtoAssembler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public function create(ExtraDtoInterface|array|null $data): ExtraDtoInterface

$option = $this->optionDtoAssembler->create($data);

return new Extra($option, $option, null);
return new Extra($option, $option);
}
}
4 changes: 2 additions & 2 deletions src/Internal/Service/LockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

final class LockService implements LockServiceInterface
{
private const LOCK_KEY = 'wallet_lock::';
private const string LOCK_KEY = 'wallet_lock::';

private const INNER_KEYS = 'inner_keys::';
private const string INNER_KEYS = 'inner_keys::';

private ?LockProvider $lockProvider = null;

Expand Down Expand Up @@ -78,7 +78,7 @@

foreach ($keys as $key) {
if (! $this->isBlocked($key)) {
continue;

Check warning on line 81 in src/Internal/Service/LockService.php

View workflow job for this annotation

GitHub Actions / units (8.3, testing, array, redis)

Escaped Mutant for Mutator "Continue_": @@ @@ $lockProvider = $this->getLockProvider(); foreach ($keys as $key) { if (!$this->isBlocked($key)) { - continue; + break; } $lockProvider->lock(self::LOCK_KEY . $key, $this->seconds)->forceRelease(); $this->lockedKeys->delete(self::INNER_KEYS . $key);
}

$lockProvider
Expand Down
10 changes: 5 additions & 5 deletions src/Internal/Service/StateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@

final readonly class StateService implements StateServiceInterface
{
private const RANDOM_BYTES = 3;
private const int RANDOM_BYTES = 3;

/**
* Keeps the state of balance
*/
private const PREFIX_STATE = 'wallet_s::';
private const string PREFIX_STATE = 'wallet_s::';

/**
* Stores a callback reference
*/
private const PREFIX_FORK_REF = 'wallet_f::';
private const string PREFIX_FORK_REF = 'wallet_f::';

/**
* Stores a pair of uuid with forkId
*/
private const PREFIX_FORK_ID = 'wallet_fc::';
private const string PREFIX_FORK_ID = 'wallet_fc::';

/**
* Stores all uuids for a particular forkId
*/
private const PREFIX_HASHMAP = 'wallet_hm::';
private const string PREFIX_HASHMAP = 'wallet_hm::';

private CacheRepository $store;

Expand Down
2 changes: 1 addition & 1 deletion src/Internal/Service/StorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final readonly class StorageService implements StorageServiceInterface
{
private const PREFIX = 'wallet_sg::';
private const string PREFIX = 'wallet_sg::';

public function __construct(
private MathServiceInterface $mathService,
Expand Down
6 changes: 4 additions & 2 deletions src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class Transaction extends Model
{
use SoftDeletes;

final public const TYPE_DEPOSIT = 'deposit';
final public const string TYPE_DEPOSIT = 'deposit';

final public const TYPE_WITHDRAW = 'withdraw';
final public const string TYPE_WITHDRAW = 'withdraw';

/**
* @var array<int, string>
Expand Down Expand Up @@ -73,6 +73,7 @@ public function casts(): array
];
}

#[\Override]
public function getTable(): string
{
if ((string) $this->table === '') {
Expand Down Expand Up @@ -125,6 +126,7 @@ public function setAmountFloatAttribute(float|int|string $amount): void
$this->amount = $math->round($math->mul($amount, $decimalPlaces));
}

#[\Override]
protected static function boot(): void
{
parent::boot();
Expand Down
12 changes: 7 additions & 5 deletions src/Models/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class Transfer extends Model
{
use SoftDeletes;

final public const STATUS_EXCHANGE = 'exchange';
final public const string STATUS_EXCHANGE = 'exchange';

final public const STATUS_TRANSFER = 'transfer';
final public const string STATUS_TRANSFER = 'transfer';

final public const STATUS_PAID = 'paid';
final public const string STATUS_PAID = 'paid';

final public const STATUS_REFUND = 'refund';
final public const string STATUS_REFUND = 'refund';

final public const STATUS_GIFT = 'gift';
final public const string STATUS_GIFT = 'gift';

/**
* @var array<int, string>
Expand Down Expand Up @@ -77,6 +77,7 @@ public function casts(): array
];
}

#[\Override]
public function getTable(): string
{
if ((string) $this->table === '') {
Expand Down Expand Up @@ -118,6 +119,7 @@ public function withdraw(): BelongsTo
return $this->belongsTo(config('wallet.transaction.model', Transaction::class), 'withdraw_id');
}

#[\Override]
protected static function boot(): void
{
parent::boot();
Expand Down
1 change: 1 addition & 0 deletions src/Models/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
];
}

#[\Override]
public function getTable(): string
{
if ((string) $this->table === '') {
Expand All @@ -108,7 +109,7 @@
* Must be updated only if the model does not exist or the slug is empty.
*/
if ($this->exists) {
return;

Check warning on line 112 in src/Models/Wallet.php

View workflow job for this annotation

GitHub Actions / units (8.3, testing, array, redis)

Escaped Mutant for Mutator "ReturnRemoval": @@ @@ * Must be updated only if the model does not exist or the slug is empty. */ if ($this->exists) { - return; + } if (array_key_exists('slug', $this->attributes)) { return;
}
if (array_key_exists('slug', $this->attributes)) {
return;
Expand Down
2 changes: 2 additions & 0 deletions src/WalletServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function boot(): void
/**
* Register services.
*/
#[\Override]
public function register(): void
{
$this->mergeConfigFrom(dirname(__DIR__).'/config/config.php', 'wallet');
Expand Down Expand Up @@ -194,6 +195,7 @@ public function register(): void
/**
* @return class-string[]
*/
#[\Override]
public function provides(): array
{
return array_merge(
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/Buyer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final class Buyer extends Model implements Customer
use CanPay;
use HasWallets;

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemDiscount.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class ItemDiscount extends Model implements ProductLimitedInterface, Disco
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemDiscountTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final class ItemDiscountTax extends Model implements ProductLimitedInterface, Di
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemMaxTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class ItemMaxTax extends Model implements ProductLimitedInterface, Maximal
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final class ItemMeta extends Model implements ProductLimitedInterface
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemMinTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class ItemMinTax extends Model implements ProductLimitedInterface, Minimal
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemMultiPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final class ItemMultiPrice extends Model implements ProductLimitedInterface
*/
protected $fillable = ['name', 'quantity', 'price', 'prices'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemTax.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class ItemTax extends Model implements ProductLimitedInterface, Taxable
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/ItemWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ final class ItemWallet extends Model implements ProductLimitedInterface
*/
protected $fillable = ['name', 'quantity', 'price'];

#[\Override]
public function getTable(): string
{
return 'items';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/UserCashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class UserCashier extends Model
use HasWallets;
use MorphOneWallet;

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/UserConfirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ final class UserConfirm extends Model implements Wallet, Confirmable
*/
protected $fillable = ['name', 'email'];

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/UserDynamic.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ final class UserDynamic extends Model implements Wallet
*/
protected $fillable = ['name', 'email'];

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/UserFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class UserFloat extends Model implements Wallet, WalletFloat
*/
protected $fillable = ['name', 'email'];

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/Models/UserMulti.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class UserMulti extends Model implements Wallet, WalletFloat
use HasWalletFloat;
use HasWallets;

#[\Override]
public function getTable(): string
{
return 'users';
Expand Down
2 changes: 1 addition & 1 deletion tests/Infra/Services/ClockFakeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

final class ClockFakeService implements ClockServiceInterface
{
public const FAKE_DATETIME = '2010-01-28T15:00:00+02:00';
public const string FAKE_DATETIME = '2010-01-28T15:00:00+02:00';

public function now(): DateTimeImmutable
{
Expand Down
1 change: 1 addition & 0 deletions tests/Infra/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ abstract class TestCase extends OrchestraTestCase
{
use RefreshDatabase;

#[\Override]
protected function setUp(): void
{
parent::setUp();
Expand Down
2 changes: 2 additions & 0 deletions tests/Units/Domain/SilentlyDiscardingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
*/
final class SilentlyDiscardingTest extends TestCase
{
#[\Override]
protected function setUp(): void
{
parent::setUp();
Model::preventSilentlyDiscardingAttributes();
}

#[\Override]
protected function tearDown(): void
{
parent::tearDown();
Expand Down
1 change: 1 addition & 0 deletions tests/Units/Domain/WalletExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
final class WalletExtensionTest extends TestCase
{
#[\Override]
protected function setUp(): void
{
parent::setUp();
Expand Down
Loading