diff --git a/.github/workflows/autofix.yaml b/.github/workflows/autofix.yaml new file mode 100644 index 000000000..123dba7b1 --- /dev/null +++ b/.github/workflows/autofix.yaml @@ -0,0 +1,89 @@ +name: fixer + +on: + push: + branches: [ 10.x ] + pull_request: + branches: [ 10.x ] + +jobs: + autofix: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + extensions: mbstring, pgsql, mysql, sqlite, redis, memcached, bcmath + coverage: pcov + env: + runner: self-hosted + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run rector-fix + run: composer rector-fix + + - name: Run ecs-fix + run: composer ecs-fix + + - name: Run rector + run: composer rector + + - name: Run ecs + run: composer ecs + + - name: Run parabench + run: composer parabench + + - name: "Check if build has changed" + if: success() + id: has-changes + run: | + echo "stdout<> $GITHUB_OUTPUT + echo "$(git diff --stat)" >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Import GPG key + if: ${{ steps.has-changes.outputs.stdout }} + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.GPG_BOT }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + fingerprint: ${{ secrets.GPG_FINGERPRINT }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + git_committer_name: Github bot + git_committer_email: bot@babichev.net + + - name: "Commit files" + if: ${{ steps.has-changes.outputs.stdout }} + env: + GH_TOKEN: ${{ secrets.BOT_TOKEN }} + run: | + gh pr checkout ${{ github.event.pull_request.number }} + git commit -S -m "autofix" -a + + - name: "Push changes" + if: ${{ steps.has-changes.outputs.stdout }} + env: + GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + run: git push -u origin HEAD \ No newline at end of file diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 1e150b30a..57eac6b47 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -2,9 +2,9 @@ name: Qodana on: workflow_dispatch: push: - branches: [ master ] + branches: [ 10.x ] pull_request: - branches: [ master ] + branches: [ 10.x ] jobs: qodana: diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml deleted file mode 100644 index 51dc2272a..000000000 --- a/.github/workflows/code-style.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: code-style - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - ecs: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - extensions: bcmath - env: - runner: self-hosted - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v4 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run ecs - run: composer ecs diff --git a/.github/workflows/deptrac.yaml b/.github/workflows/deptrac.yaml index 13769bde1..64cc3465f 100644 --- a/.github/workflows/deptrac.yaml +++ b/.github/workflows/deptrac.yaml @@ -2,9 +2,9 @@ name: deptrac on: push: - branches: [ master ] + branches: [ 10.x ] pull_request: - branches: [ master ] + branches: [ 10.x ] jobs: deptrac: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index ff24d585b..77a5ba4af 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -2,7 +2,7 @@ name: build docs on: pull_request: - branches: [ master ] + branches: [ 10.x ] jobs: build_pages: diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml index befbf417a..a217b4c98 100644 --- a/.github/workflows/phpstan.yaml +++ b/.github/workflows/phpstan.yaml @@ -2,9 +2,9 @@ name: phpstan on: push: - branches: [ master ] + branches: [ 10.x ] pull_request: - branches: [ master ] + branches: [ 10.x ] jobs: phpstan: diff --git a/.github/workflows/phpunits.yaml b/.github/workflows/phpunits.yaml index 3da3d2e9b..175fc3025 100644 --- a/.github/workflows/phpunits.yaml +++ b/.github/workflows/phpunits.yaml @@ -2,9 +2,9 @@ name: phpunits on: push: - branches: [ master ] + branches: [ 10.x ] pull_request: - branches: [ master ] + branches: [ 10.x ] env: MEMCACHED_HOST: localhost @@ -19,6 +19,7 @@ jobs: strategy: matrix: php-versions: [8.1, 8.2, 8.3] + stability: [prefer-lowest, prefer-stable] databases: [testing, pgsql, mysql, mariadb] caches: [array, redis, memcached, database] locks: [redis, memcached] @@ -73,7 +74,7 @@ jobs: - 3306:3306 mariadb: - image: mariadb:10.5 + image: mariadb:10.10 env: MYSQL_ROOT_PASSWORD: wallet MYSQL_DATABASE: wallet @@ -115,11 +116,11 @@ jobs: - name: Install dependencies id: composer-dependencies - run: composer install --prefer-dist --no-progress + run: composer update --${{ matrix.stability }} --prefer-dist --no-progress - name: Check codeclimate id: codeclimate-check - run: echo "execute=${{ matrix.php-versions == '8.2' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT + run: echo "execute=${{ matrix.php-versions == '8.3' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT - name: Prepare codeclimate id: codeclimate-prepare diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml deleted file mode 100644 index 2739226cc..000000000 --- a/.github/workflows/rector.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: rector - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - rector: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.1 - extensions: bcmath - env: - runner: self-hosted - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v4 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run rector - run: composer rector diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index e900f715a..0d0cd01dd 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -2,9 +2,9 @@ name: semgrep on: push: - branches: [ master ] + branches: [ 10.x ] pull_request: - branches: [ master ] + branches: [ 10.x ] jobs: semgrep: diff --git a/README.md b/README.md index 28ad79152..e66e1243b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ laravel-wallet - Easy work with virtual wallet. | 7.x | ^6.0,^7.0,^8.0 | 7.4,8.0,8.1 | Nov 25, 2021 | Mar 1, 2022 | Sep 6, 2022 | | 8.x | ^9.0 | 8.0,8.1 | Feb 8, 2022 | May 1, 2022 | Jun 1, 2022 | | 9.x [LTS] | ^9.0,^10.0 | 8.0,8.1,8.2,8.3 | May 2, 2022 | Feb 1, 2023 | Feb 6, 2024 | -| 10.x [LTS] | ^10.0 | 8.1,8.2,8.3 | Jul 8, 2023 | May 1, 2024 | Feb 4, 2025 | +| 10.x [LTS] | ^10.0,^11.0 | 8.1,8.2,8.3 | Jul 8, 2023 | May 1, 2024 | Feb 4, 2025 | ### Upgrade Guide diff --git a/composer.json b/composer.json index e8d99e14d..23360fce2 100644 --- a/composer.json +++ b/composer.json @@ -26,28 +26,28 @@ "ext-json": "*", "ext-pdo": "*", "brick/math": "~0.10", - "doctrine/dbal": "^3.5", - "illuminate/contracts": "^10.0", - "illuminate/database": "^10.0", + "illuminate/contracts": "^10.0|^11.0", + "illuminate/database": "^10.0|^11.0", "ramsey/uuid": "^4.0" }, "require-dev": { - "brianium/paratest": "^7.2", - "cknow/laravel-money": "^7.1", - "ergebnis/phpstan-rules": "^1.0", + "brianium/paratest": "^7.3", + "ergebnis/phpstan-rules": "^2.1", "infection/infection": "~0.27", "laravel/cashier": "^15.0", - "nunomaduro/collision": "^7.7", - "nunomaduro/larastan": "^2.6", - "orchestra/testbench": "^8.5", + "nunomaduro/collision": "^7.8|^8.0", + "larastan/larastan": "^2.8", + "orchestra/testbench": "^8.21|^9.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.2", - "rector/rector": "^0.19", + "phpunit/phpunit": "^10.5", + "rector/rector": "^1.0", "symplify/easy-coding-standard": "^12.0" }, "suggest": { "bavix/laravel-wallet-swap": "Addition to the laravel-wallet library for quick setting of exchange rates", - "bavix/laravel-wallet-warmup": "Addition to the laravel-wallet library for refresh balance wallets" + "bavix/laravel-wallet-uuid": "Addition to the laravel-wallet library uuid support in laravel-wallet", + "bavix/laravel-wallet-warmup": "Addition to the laravel-wallet library for refresh balance wallets", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^3.5.1)." }, "autoload": { "psr-4": { diff --git a/phpstan.common.neon b/phpstan.common.neon index 8d97ee03a..5e647514c 100644 --- a/phpstan.common.neon +++ b/phpstan.common.neon @@ -1,60 +1,8 @@ includes: - - vendor/nunomaduro/larastan/extension.neon + - vendor/larastan/larastan/extension.neon + - vendor/ergebnis/phpstan-rules/rules.neon parameters: level: 9 fileExtensions: - - php - -parametersSchema: - ergebnis: structure([ - allowAbstractClasses: bool() - classesAllowedToBeExtended: listOf(string()) - classesNotRequiredToBeAbstractOrFinal: listOf(string()) - interfacesImplementedByContainers: listOf(string()) - ]) - -rules: - - Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule - - Ergebnis\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule - - Ergebnis\PHPStan\Rules\Expressions\NoCompactRule - - Ergebnis\PHPStan\Rules\Expressions\NoEmptyRule - - Ergebnis\PHPStan\Rules\Expressions\NoErrorSuppressionRule - - Ergebnis\PHPStan\Rules\Expressions\NoEvalRule - - Ergebnis\PHPStan\Rules\Expressions\NoIssetRule - - Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule - - Ergebnis\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule - - Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule - - Ergebnis\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule - - Ergebnis\PHPStan\Rules\Methods\FinalInAbstractClassRule - - Ergebnis\PHPStan\Rules\Methods\NoConstructorParameterWithDefaultValueRule - - Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule - - Ergebnis\PHPStan\Rules\Statements\NoSwitchRule - -services: - - - class: Ergebnis\PHPStan\Rules\Classes\FinalRule - arguments: - allowAbstractClasses: %ergebnis.allowAbstractClasses% - classesNotRequiredToBeAbstractOrFinal: %ergebnis.classesNotRequiredToBeAbstractOrFinal% - tags: - - phpstan.rules.rule - - - - class: Ergebnis\PHPStan\Rules\Classes\NoExtendsRule - arguments: - classesAllowedToBeExtended: %ergebnis.classesAllowedToBeExtended% - tags: - - phpstan.rules.rule - - - - class: Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule - tags: - - phpstan.rules.rule - - - - class: Ergebnis\PHPStan\Rules\Methods\NoParameterWithContainerTypeDeclarationRule - arguments: - interfacesImplementedByContainers: %ergebnis.interfacesImplementedByContainers% - tags: - - phpstan.rules.rule + - php \ No newline at end of file diff --git a/phpstan.src.baseline.neon b/phpstan.src.baseline.neon index 4b7b1f4ad..b64dd3355 100644 --- a/phpstan.src.baseline.neon +++ b/phpstan.src.baseline.neon @@ -82,7 +82,7 @@ parameters: - message: "#^Parameter \\#1 \\$related of method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:hasMany\\(\\) expects string, mixed given\\.$#" - count: 4 + count: 5 path: src/Models/Wallet.php - diff --git a/phpstan.src.neon b/phpstan.src.neon index 7952daa9c..1ecc9585d 100644 --- a/phpstan.src.neon +++ b/phpstan.src.neon @@ -7,24 +7,32 @@ parameters: fileExtensions: - php ergebnis: - allowAbstractClasses: true - classesAllowedToBeExtended: - # laravel - - Illuminate\Support\ServiceProvider - - Illuminate\Database\Eloquent\Model + noParameterWithNullableTypeDeclaration: + enabled: false + noNullableReturnTypeDeclaration: + enabled: false + noParameterWithNullDefaultValue: + enabled: false + final: + allowAbstractClasses: true + classesNotRequiredToBeAbstractOrFinal: + - Bavix\Wallet\Models\Wallet + - Bavix\Wallet\Models\Transfer + - Bavix\Wallet\Models\Transaction + noExtends: + classesAllowedToBeExtended: + # laravel + - Illuminate\Support\ServiceProvider + - Illuminate\Database\Eloquent\Model - # php exceptions - - LogicException - - RuntimeException - - UnderflowException - - UnexpectedValueException - - InvalidArgumentException - - classesNotRequiredToBeAbstractOrFinal: - - Bavix\Wallet\Models\Wallet - - Bavix\Wallet\Models\Transfer - - Bavix\Wallet\Models\Transaction - interfacesImplementedByContainers: - - Psr\Container\ContainerInterface + # php exceptions + - LogicException + - RuntimeException + - UnderflowException + - UnexpectedValueException + - InvalidArgumentException + noParameterWithContainerTypeDeclaration: + interfacesImplementedByContainers: + - Psr\Container\ContainerInterface paths: - - src/ + - src/ \ No newline at end of file diff --git a/phpstan.tests.neon b/phpstan.tests.neon index 85854cf85..206a2032c 100644 --- a/phpstan.tests.neon +++ b/phpstan.tests.neon @@ -9,32 +9,41 @@ parameters: fileExtensions: - php ergebnis: - allowAbstractClasses: false - classesAllowedToBeExtended: - # laravel - - Illuminate\Support\ServiceProvider - - Illuminate\Database\Eloquent\Model - - Illuminate\Database\Migrations\Migration - - Illuminate\Database\Eloquent\Factories\Factory + noParameterWithNullableTypeDeclaration: + enabled: false + noNullableReturnTypeDeclaration: + enabled: false + noParameterWithNullDefaultValue: + enabled: false + final: + allowAbstractClasses: false + classesNotRequiredToBeAbstractOrFinal: + - Bavix\Wallet\Models\Wallet + - Bavix\Wallet\Models\Transfer + - Bavix\Wallet\Models\Transaction + noExtends: + classesAllowedToBeExtended: + # laravel + - Illuminate\Support\ServiceProvider + - Illuminate\Database\Eloquent\Model + - Illuminate\Database\Migrations\Migration + - Illuminate\Database\Eloquent\Factories\Factory - # php exceptions - - RuntimeException - - InvalidArgumentException + # php exceptions + - RuntimeException + - InvalidArgumentException - # phpunit - - Orchestra\Testbench\TestCase - - Bavix\Wallet\Test\Infra\TestCase + # phpunit + - Orchestra\Testbench\TestCase + - Bavix\Wallet\Test\Infra\TestCase - # wallet - - Bavix\Wallet\Models\Wallet - - Bavix\Wallet\Models\Transfer - - Bavix\Wallet\Models\Transaction + # wallet + - Bavix\Wallet\Models\Wallet + - Bavix\Wallet\Models\Transfer + - Bavix\Wallet\Models\Transaction - classesNotRequiredToBeAbstractOrFinal: - - Bavix\Wallet\Models\Wallet - - Bavix\Wallet\Models\Transfer - - Bavix\Wallet\Models\Transaction - interfacesImplementedByContainers: - - Psr\Container\ContainerInterface + noParameterWithContainerTypeDeclaration: + interfacesImplementedByContainers: + - Psr\Container\ContainerInterface paths: - - tests/ + - tests/ \ No newline at end of file diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index 5672da404..0bae76222 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -38,7 +38,7 @@ class Transaction extends Model final public const TYPE_WITHDRAW = 'withdraw'; /** - * @var string[] + * @var array */ protected $fillable = [ 'payable_type', diff --git a/src/Models/Transfer.php b/src/Models/Transfer.php index 89f23444b..58d35d49e 100644 --- a/src/Models/Transfer.php +++ b/src/Models/Transfer.php @@ -42,7 +42,7 @@ class Transfer extends Model final public const STATUS_GIFT = 'gift'; /** - * @var string[] + * @var array */ protected $fillable = [ 'status', diff --git a/src/Models/Wallet.php b/src/Models/Wallet.php index 51f32a853..c9e89b0fa 100644 --- a/src/Models/Wallet.php +++ b/src/Models/Wallet.php @@ -55,7 +55,7 @@ class Wallet extends Model implements Customer, WalletFloat, Confirmable, Exchan use HasGift; /** - * @var string[] + * @var array */ protected $fillable = [ 'holder_type', @@ -159,11 +159,6 @@ public function getCurrencyAttribute(): string return $this->meta['currency'] ?? Str::upper($this->slug); } - protected function initializeMorphOneWallet(): void - { - $this->uuid ??= app(UuidFactoryServiceInterface::class)->uuid4(); - } - /** * returns all the receiving transfers to this wallet. * @@ -173,4 +168,9 @@ public function receivedTransfers(): HasMany { return $this->hasMany(config('wallet.transfer.model', Transfer::class), 'to_id'); } + + protected function initializeMorphOneWallet(): void + { + $this->uuid ??= app(UuidFactoryServiceInterface::class)->uuid4(); + } } diff --git a/tests/Infra/Models/Item.php b/tests/Infra/Models/Item.php index 2ae3e37dd..fd2a5e981 100644 --- a/tests/Infra/Models/Item.php +++ b/tests/Infra/Models/Item.php @@ -29,7 +29,7 @@ final class Item extends Model implements ProductLimitedInterface use HasWallets; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemDiscount.php b/tests/Infra/Models/ItemDiscount.php index 8d0e78567..8cf5ac656 100644 --- a/tests/Infra/Models/ItemDiscount.php +++ b/tests/Infra/Models/ItemDiscount.php @@ -24,7 +24,7 @@ final class ItemDiscount extends Model implements ProductLimitedInterface, Disco use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemDiscountTax.php b/tests/Infra/Models/ItemDiscountTax.php index 48a41b0c6..14e4ff583 100644 --- a/tests/Infra/Models/ItemDiscountTax.php +++ b/tests/Infra/Models/ItemDiscountTax.php @@ -25,7 +25,7 @@ final class ItemDiscountTax extends Model implements ProductLimitedInterface, Di use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemMaxTax.php b/tests/Infra/Models/ItemMaxTax.php index 3c3fa3955..4f1ebee67 100644 --- a/tests/Infra/Models/ItemMaxTax.php +++ b/tests/Infra/Models/ItemMaxTax.php @@ -24,7 +24,7 @@ final class ItemMaxTax extends Model implements ProductLimitedInterface, Maximal use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemMeta.php b/tests/Infra/Models/ItemMeta.php index f6adb0a28..65d4edd08 100644 --- a/tests/Infra/Models/ItemMeta.php +++ b/tests/Infra/Models/ItemMeta.php @@ -25,7 +25,7 @@ final class ItemMeta extends Model implements ProductLimitedInterface use HasWallets; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemMinTax.php b/tests/Infra/Models/ItemMinTax.php index b2b951842..57832ee6b 100644 --- a/tests/Infra/Models/ItemMinTax.php +++ b/tests/Infra/Models/ItemMinTax.php @@ -24,7 +24,7 @@ final class ItemMinTax extends Model implements ProductLimitedInterface, Minimal use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemMultiPrice.php b/tests/Infra/Models/ItemMultiPrice.php index ed8696636..8399ab3cc 100644 --- a/tests/Infra/Models/ItemMultiPrice.php +++ b/tests/Infra/Models/ItemMultiPrice.php @@ -25,7 +25,7 @@ final class ItemMultiPrice extends Model implements ProductLimitedInterface use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price', 'prices']; diff --git a/tests/Infra/Models/ItemTax.php b/tests/Infra/Models/ItemTax.php index e9a812695..9d4e5dec9 100644 --- a/tests/Infra/Models/ItemTax.php +++ b/tests/Infra/Models/ItemTax.php @@ -24,7 +24,7 @@ final class ItemTax extends Model implements ProductLimitedInterface, Taxable use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/ItemWallet.php b/tests/Infra/Models/ItemWallet.php index 35d30cffe..70fe59e18 100644 --- a/tests/Infra/Models/ItemWallet.php +++ b/tests/Infra/Models/ItemWallet.php @@ -25,7 +25,7 @@ final class ItemWallet extends Model implements ProductLimitedInterface use HasWallets; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'quantity', 'price']; diff --git a/tests/Infra/Models/Manager.php b/tests/Infra/Models/Manager.php index 63c6be65a..62d9b8af2 100644 --- a/tests/Infra/Models/Manager.php +++ b/tests/Infra/Models/Manager.php @@ -19,7 +19,7 @@ final class Manager extends Model implements Wallet use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'email']; } diff --git a/tests/Infra/Models/User.php b/tests/Infra/Models/User.php index f5c5084c2..70b2c2496 100644 --- a/tests/Infra/Models/User.php +++ b/tests/Infra/Models/User.php @@ -19,7 +19,7 @@ final class User extends Model implements Wallet use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'email']; } diff --git a/tests/Infra/Models/UserConfirm.php b/tests/Infra/Models/UserConfirm.php index 269faf96f..66d1781f4 100644 --- a/tests/Infra/Models/UserConfirm.php +++ b/tests/Infra/Models/UserConfirm.php @@ -22,7 +22,7 @@ final class UserConfirm extends Model implements Wallet, Confirmable use CanConfirm; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'email']; diff --git a/tests/Infra/Models/UserDynamic.php b/tests/Infra/Models/UserDynamic.php index af81cff8b..d16b8e04f 100644 --- a/tests/Infra/Models/UserDynamic.php +++ b/tests/Infra/Models/UserDynamic.php @@ -19,7 +19,7 @@ final class UserDynamic extends Model implements Wallet use HasWallet; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'email']; diff --git a/tests/Infra/Models/UserFloat.php b/tests/Infra/Models/UserFloat.php index e93631505..3c7cd24ee 100644 --- a/tests/Infra/Models/UserFloat.php +++ b/tests/Infra/Models/UserFloat.php @@ -20,7 +20,7 @@ final class UserFloat extends Model implements Wallet, WalletFloat use HasWalletFloat; /** - * @var string[] + * @var array */ protected $fillable = ['name', 'email']; diff --git a/tests/Infra/PackageModels/TransactionMoney.php b/tests/Infra/PackageModels/TransactionMoney.php index 13dcd28ed..b9dfc13b4 100644 --- a/tests/Infra/PackageModels/TransactionMoney.php +++ b/tests/Infra/PackageModels/TransactionMoney.php @@ -4,7 +4,7 @@ namespace Bavix\Wallet\Test\Infra\PackageModels; -use Cknow\Money\Money; +use Bavix\Wallet\Test\Infra\Values\Money; /** * Class Transaction. @@ -17,7 +17,7 @@ final class TransactionMoney extends \Bavix\Wallet\Models\Transaction public function getCurrencyAttribute(): Money { - $this->currency ??= \money($this->amount, $this->meta['currency'] ?? 'USD'); + $this->currency ??= new Money($this->amount, $this->meta['currency'] ?? 'USD'); return $this->currency; } diff --git a/tests/Infra/Values/Money.php b/tests/Infra/Values/Money.php new file mode 100644 index 000000000..49cc06be5 --- /dev/null +++ b/tests/Infra/Values/Money.php @@ -0,0 +1,14 @@ +getKey() > 0); self::assertSame($transaction->amountInt, $buyer->balanceInt); self::assertInstanceOf(TransactionMoney::class, $transaction); - self::assertSame('1000', $transaction->currency->getAmount()); - self::assertSame('EUR', $transaction->currency->getCurrency()->getCode()); + self::assertSame('1000', $transaction->currency->amount); + self::assertSame('EUR', $transaction->currency->currency); } public function testNoCustomAttribute(): void