From 21def0a8144ca93dea69aeb628d36cdb14bd3679 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Mon, 17 Nov 2025 18:41:36 +0300 Subject: [PATCH 1/4] Update PHP versions in GitHub Actions workflow to include 8.5 --- .github/workflows/phpunits.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunits.yaml b/.github/workflows/phpunits.yaml index f4ca2961..b15fa651 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] From 4a6c0cb2e8793eaf165c546d8e2da157e2102f87 Mon Sep 17 00:00:00 2001 From: Github bot Date: Mon, 17 Nov 2025 15:44:08 +0000 Subject: [PATCH 2/4] autofix --- src/Internal/Assembler/ExtraDtoAssembler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Internal/Assembler/ExtraDtoAssembler.php b/src/Internal/Assembler/ExtraDtoAssembler.php index fa28896f..a8417735 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); } } From ff64004edc83a12503a830cca456555c8691c632 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Mon, 17 Nov 2025 18:44:41 +0300 Subject: [PATCH 3/4] Update PHP version requirements and add #[\Override] attributes - Updated the required PHP version in composer.json from ^8.2 to ^8.3. - Modified README.md to reflect the new PHP version compatibility. - Changed Rector configuration to import PHP 8.3 features. - Added #[\Override] attributes to several methods across various models and services for better clarity and adherence to PHP 8.3 standards. - Updated constant declarations to use 'string' type hints in multiple classes. --- README.md | 2 +- composer.json | 2 +- rector.php | 2 +- src/Internal/Service/LockService.php | 4 ++-- src/Internal/Service/StateService.php | 10 +++++----- src/Internal/Service/StorageService.php | 2 +- src/Models/Transaction.php | 6 ++++-- src/Models/Transfer.php | 12 +++++++----- src/Models/Wallet.php | 1 + src/WalletServiceProvider.php | 2 ++ tests/Infra/Models/Buyer.php | 1 + tests/Infra/Models/ItemDiscount.php | 1 + tests/Infra/Models/ItemDiscountTax.php | 1 + tests/Infra/Models/ItemMaxTax.php | 1 + tests/Infra/Models/ItemMeta.php | 1 + tests/Infra/Models/ItemMinTax.php | 1 + tests/Infra/Models/ItemMultiPrice.php | 1 + tests/Infra/Models/ItemTax.php | 1 + tests/Infra/Models/ItemWallet.php | 1 + tests/Infra/Models/UserCashier.php | 1 + tests/Infra/Models/UserConfirm.php | 1 + tests/Infra/Models/UserDynamic.php | 1 + tests/Infra/Models/UserFloat.php | 1 + tests/Infra/Models/UserMulti.php | 1 + tests/Infra/Services/ClockFakeService.php | 2 +- tests/Infra/TestCase.php | 1 + tests/Units/Domain/SilentlyDiscardingTest.php | 2 ++ tests/Units/Domain/WalletExtensionTest.php | 1 + 28 files changed, 44 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d3493b17..5c24e567 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 9e7ef64e..babcb096 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", diff --git a/rector.php b/rector.php index 6cf3e87a..58753258 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/Service/LockService.php b/src/Internal/Service/LockService.php index 96342ddb..18280581 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 99878167..d03613b6 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 a9259b72..1c7db5be 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 b804eb3b..43063210 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 133fa146..7e331f73 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 94719f19..2da75e13 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 364307b0..3eaaed4e 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 7a16ff32..51e8f8ab 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 54754887..f8338c0d 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 c4a037b1..a1eeada0 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 99b5b276..033cf389 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 bbc74289..fdd1651f 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 ed0790c6..056eabe3 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 1d10619f..a23a69ac 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 0402d2af..cd8cc4f8 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 dca41e95..1cac8d23 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 0c8c8344..6d23b1b6 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 b17651ae..98a87161 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 5d4b076b..e88c9fe0 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 a5b6dce8..93970a54 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 1cde550f..05c571ac 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 13695aaf..9cd72420 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 643bed70..ee8ddbea 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 fed8cf10..f6ad4bcc 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 01d2351e..cbcd130a 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(); From 7f9aaa7aceda470ebef21ae0c0a1f3804313574d Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Mon, 17 Nov 2025 18:55:00 +0300 Subject: [PATCH 4/4] Update symplify/easy-coding-standard dependency version in composer.json - Bumped symplify/easy-coding-standard from version ^12.1 to ^13.0 for improved coding standards and compatibility. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index babcb096..933f906b 100644 --- a/composer.json +++ b/composer.json @@ -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",