diff --git a/.github/workflows/phpunits.yaml b/.github/workflows/phpunits.yaml index f4ca2961f..b15fa6510 100644 --- a/.github/workflows/phpunits.yaml +++ b/.github/workflows/phpunits.yaml @@ -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] diff --git a/README.md b/README.md index d3493b172..5c24e567a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/composer.json b/composer.json index 9e7ef64ea..933f906bb 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ } ], "require": { - "php": "^8.2", + "php": "^8.3", "ext-json": "*", "ext-pdo": "*", "brick/math": "~0.10", @@ -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", diff --git a/rector.php b/rector.php index 6cf3e87ad..587532587 100644 --- a/rector.php +++ b/rector.php @@ -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); }; diff --git a/src/Internal/Assembler/ExtraDtoAssembler.php b/src/Internal/Assembler/ExtraDtoAssembler.php index fa28896f0..a8417735f 100644 --- a/src/Internal/Assembler/ExtraDtoAssembler.php +++ b/src/Internal/Assembler/ExtraDtoAssembler.php @@ -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); } } diff --git a/src/Internal/Service/LockService.php b/src/Internal/Service/LockService.php index 96342ddbe..18280581b 100644 --- a/src/Internal/Service/LockService.php +++ b/src/Internal/Service/LockService.php @@ -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; diff --git a/src/Internal/Service/StateService.php b/src/Internal/Service/StateService.php index 998781679..d03613b66 100644 --- a/src/Internal/Service/StateService.php +++ b/src/Internal/Service/StateService.php @@ -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; diff --git a/src/Internal/Service/StorageService.php b/src/Internal/Service/StorageService.php index a9259b727..1c7db5be6 100644 --- a/src/Internal/Service/StorageService.php +++ b/src/Internal/Service/StorageService.php @@ -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, diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index b804eb3b9..430632105 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -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 @@ -73,6 +73,7 @@ public function casts(): array ]; } + #[\Override] public function getTable(): string { if ((string) $this->table === '') { @@ -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(); diff --git a/src/Models/Transfer.php b/src/Models/Transfer.php index 133fa1462..7e331f73b 100644 --- a/src/Models/Transfer.php +++ b/src/Models/Transfer.php @@ -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 @@ -77,6 +77,7 @@ public function casts(): array ]; } + #[\Override] public function getTable(): string { if ((string) $this->table === '') { @@ -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(); diff --git a/src/Models/Wallet.php b/src/Models/Wallet.php index 94719f19c..2da75e13d 100644 --- a/src/Models/Wallet.php +++ b/src/Models/Wallet.php @@ -92,6 +92,7 @@ public function casts(): array ]; } + #[\Override] public function getTable(): string { if ((string) $this->table === '') { diff --git a/src/WalletServiceProvider.php b/src/WalletServiceProvider.php index 364307b07..3eaaed4e9 100644 --- a/src/WalletServiceProvider.php +++ b/src/WalletServiceProvider.php @@ -160,6 +160,7 @@ public function boot(): void /** * Register services. */ + #[\Override] public function register(): void { $this->mergeConfigFrom(dirname(__DIR__).'/config/config.php', 'wallet'); @@ -194,6 +195,7 @@ public function register(): void /** * @return class-string[] */ + #[\Override] public function provides(): array { return array_merge( diff --git a/tests/Infra/Models/Buyer.php b/tests/Infra/Models/Buyer.php index 7a16ff320..51e8f8abb 100644 --- a/tests/Infra/Models/Buyer.php +++ b/tests/Infra/Models/Buyer.php @@ -20,6 +20,7 @@ final class Buyer extends Model implements Customer use CanPay; use HasWallets; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Models/ItemDiscount.php b/tests/Infra/Models/ItemDiscount.php index 547548870..f8338c0d5 100644 --- a/tests/Infra/Models/ItemDiscount.php +++ b/tests/Infra/Models/ItemDiscount.php @@ -28,6 +28,7 @@ final class ItemDiscount extends Model implements ProductLimitedInterface, Disco */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemDiscountTax.php b/tests/Infra/Models/ItemDiscountTax.php index c4a037b16..a1eeada0f 100644 --- a/tests/Infra/Models/ItemDiscountTax.php +++ b/tests/Infra/Models/ItemDiscountTax.php @@ -29,6 +29,7 @@ final class ItemDiscountTax extends Model implements ProductLimitedInterface, Di */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemMaxTax.php b/tests/Infra/Models/ItemMaxTax.php index 99b5b2761..033cf389a 100644 --- a/tests/Infra/Models/ItemMaxTax.php +++ b/tests/Infra/Models/ItemMaxTax.php @@ -28,6 +28,7 @@ final class ItemMaxTax extends Model implements ProductLimitedInterface, Maximal */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemMeta.php b/tests/Infra/Models/ItemMeta.php index bbc74289e..fdd1651f5 100644 --- a/tests/Infra/Models/ItemMeta.php +++ b/tests/Infra/Models/ItemMeta.php @@ -29,6 +29,7 @@ final class ItemMeta extends Model implements ProductLimitedInterface */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemMinTax.php b/tests/Infra/Models/ItemMinTax.php index ed0790c68..056eabe34 100644 --- a/tests/Infra/Models/ItemMinTax.php +++ b/tests/Infra/Models/ItemMinTax.php @@ -28,6 +28,7 @@ final class ItemMinTax extends Model implements ProductLimitedInterface, Minimal */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemMultiPrice.php b/tests/Infra/Models/ItemMultiPrice.php index 1d10619f7..a23a69ac0 100644 --- a/tests/Infra/Models/ItemMultiPrice.php +++ b/tests/Infra/Models/ItemMultiPrice.php @@ -29,6 +29,7 @@ final class ItemMultiPrice extends Model implements ProductLimitedInterface */ protected $fillable = ['name', 'quantity', 'price', 'prices']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemTax.php b/tests/Infra/Models/ItemTax.php index 0402d2afa..cd8cc4f85 100644 --- a/tests/Infra/Models/ItemTax.php +++ b/tests/Infra/Models/ItemTax.php @@ -28,6 +28,7 @@ final class ItemTax extends Model implements ProductLimitedInterface, Taxable */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/ItemWallet.php b/tests/Infra/Models/ItemWallet.php index dca41e953..1cac8d232 100644 --- a/tests/Infra/Models/ItemWallet.php +++ b/tests/Infra/Models/ItemWallet.php @@ -29,6 +29,7 @@ final class ItemWallet extends Model implements ProductLimitedInterface */ protected $fillable = ['name', 'quantity', 'price']; + #[\Override] public function getTable(): string { return 'items'; diff --git a/tests/Infra/Models/UserCashier.php b/tests/Infra/Models/UserCashier.php index 0c8c83442..6d23b1b62 100644 --- a/tests/Infra/Models/UserCashier.php +++ b/tests/Infra/Models/UserCashier.php @@ -21,6 +21,7 @@ final class UserCashier extends Model use HasWallets; use MorphOneWallet; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Models/UserConfirm.php b/tests/Infra/Models/UserConfirm.php index b17651ae2..98a871616 100644 --- a/tests/Infra/Models/UserConfirm.php +++ b/tests/Infra/Models/UserConfirm.php @@ -26,6 +26,7 @@ final class UserConfirm extends Model implements Wallet, Confirmable */ protected $fillable = ['name', 'email']; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Models/UserDynamic.php b/tests/Infra/Models/UserDynamic.php index 5d4b076ba..e88c9fe0d 100644 --- a/tests/Infra/Models/UserDynamic.php +++ b/tests/Infra/Models/UserDynamic.php @@ -23,6 +23,7 @@ final class UserDynamic extends Model implements Wallet */ protected $fillable = ['name', 'email']; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Models/UserFloat.php b/tests/Infra/Models/UserFloat.php index a5b6dce84..93970a54c 100644 --- a/tests/Infra/Models/UserFloat.php +++ b/tests/Infra/Models/UserFloat.php @@ -24,6 +24,7 @@ final class UserFloat extends Model implements Wallet, WalletFloat */ protected $fillable = ['name', 'email']; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Models/UserMulti.php b/tests/Infra/Models/UserMulti.php index 1cde550f1..05c571ac7 100644 --- a/tests/Infra/Models/UserMulti.php +++ b/tests/Infra/Models/UserMulti.php @@ -21,6 +21,7 @@ final class UserMulti extends Model implements Wallet, WalletFloat use HasWalletFloat; use HasWallets; + #[\Override] public function getTable(): string { return 'users'; diff --git a/tests/Infra/Services/ClockFakeService.php b/tests/Infra/Services/ClockFakeService.php index 13695aafe..9cd724208 100644 --- a/tests/Infra/Services/ClockFakeService.php +++ b/tests/Infra/Services/ClockFakeService.php @@ -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 { diff --git a/tests/Infra/TestCase.php b/tests/Infra/TestCase.php index 643bed70b..ee8ddbeaa 100644 --- a/tests/Infra/TestCase.php +++ b/tests/Infra/TestCase.php @@ -22,6 +22,7 @@ abstract class TestCase extends OrchestraTestCase { use RefreshDatabase; + #[\Override] protected function setUp(): void { parent::setUp(); diff --git a/tests/Units/Domain/SilentlyDiscardingTest.php b/tests/Units/Domain/SilentlyDiscardingTest.php index fed8cf10e..f6ad4bccf 100644 --- a/tests/Units/Domain/SilentlyDiscardingTest.php +++ b/tests/Units/Domain/SilentlyDiscardingTest.php @@ -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(); diff --git a/tests/Units/Domain/WalletExtensionTest.php b/tests/Units/Domain/WalletExtensionTest.php index 01d2351e7..cbcd130ab 100644 --- a/tests/Units/Domain/WalletExtensionTest.php +++ b/tests/Units/Domain/WalletExtensionTest.php @@ -17,6 +17,7 @@ */ final class WalletExtensionTest extends TestCase { + #[\Override] protected function setUp(): void { parent::setUp();