From 0babbd565488952df6e63f5e7a6c0f5c04d1c9e1 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Sun, 9 Jul 2023 09:56:19 +0300 Subject: [PATCH] add support laravel-wallet:^10.0 (#30) * add support laravel-wallet:^10.0 * ecs-fix * fix units --- .github/workflows/code-style.yaml | 2 +- .github/workflows/phpstan.yaml | 2 +- .github/workflows/phpunits.yaml | 4 +-- .github/workflows/psalm.yaml | 40 -------------------------- .github/workflows/rector.yaml | 2 +- composer.json | 24 +++++++--------- phpunit.xml | 10 ++++--- psalm.xml | 12 -------- rector.php | 16 ++--------- tests/Infra/Factories/BuyerFactory.php | 6 ++-- tests/Infra/Models/Buyer.php | 13 ++++++++- 11 files changed, 41 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/psalm.yaml delete mode 100644 psalm.xml diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml index fdcd30e..5289c21 100644 --- a/.github/workflows/code-style.yaml +++ b/.github/workflows/code-style.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.1 env: runner: self-hosted diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml index 7b5dfa5..7a92efa 100644 --- a/.github/workflows/phpstan.yaml +++ b/.github/workflows/phpstan.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.1 env: runner: self-hosted diff --git a/.github/workflows/phpunits.yaml b/.github/workflows/phpunits.yaml index 760c8d1..62dba79 100644 --- a/.github/workflows/phpunits.yaml +++ b/.github/workflows/phpunits.yaml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - php-versions: [8.0, 8.1] + php-versions: [8.1, 8.2] databases: [testing, pgsql, mysql, mariadb] caches: [array, redis, memcached] @@ -119,7 +119,7 @@ jobs: - name: Check codeclimate id: codeclimate-check - run: echo "execute=${{ matrix.php-versions == '8.0' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT + run: echo "execute=${{ matrix.php-versions == '8.2' && matrix.caches == 'array' && matrix.databases == 'testing' }}" >> $GITHUB_OUTPUT - name: Prepare codeclimate id: codeclimate-prepare diff --git a/.github/workflows/psalm.yaml b/.github/workflows/psalm.yaml deleted file mode 100644 index d9d176f..0000000 --- a/.github/workflows/psalm.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: psalm - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - psalm: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.0 - 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@v2 - 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 psalm - run: composer psalm diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index 56bab8a..32d71a4 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.1 env: runner: self-hosted diff --git a/composer.json b/composer.json index 6af2e69..d6add7f 100644 --- a/composer.json +++ b/composer.json @@ -22,20 +22,20 @@ } ], "require": { - "php": "^8.0", - "bavix/laravel-wallet": "^9.0" + "php": "^8.1", + "bavix/laravel-wallet": "^10.0" }, "require-dev": { - "brianium/paratest": "^6.4", + "brianium/paratest": "^7.2", + "driftingly/rector-laravel": "^0.21.0", "ergebnis/phpstan-rules": "^1.0", - "infection/infection": "~0.26", - "nunomaduro/collision": "^6.2", - "orchestra/testbench": "^7.4", - "phpstan/phpstan": "^1.5", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.14", - "symplify/easy-coding-standard": "^11.1", - "vimeo/psalm": "^4.13" + "infection/infection": "~0.27", + "nunomaduro/collision": "^7.7", + "orchestra/testbench": "^8.5", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.2", + "rector/rector": "^0.17", + "symplify/easy-coding-standard": "^11.5" }, "autoload": { "psr-4": { @@ -65,8 +65,6 @@ "ecs": "@php vendor/bin/ecs check", "ecs-fix": "@php vendor/bin/ecs check --fix", "ecs-cc": "@php vendor/bin/ecs --clear-cache", - "psalm": "@php vendor/bin/psalm", - "psalm-cc": "@php vendor/bin/psalm --clear-cache", "rector": "@php vendor/bin/rector process --dry-run", "rector-fix": "@php vendor/bin/rector process" }, diff --git a/phpunit.xml b/phpunit.xml index a9cc4a2..4b8b29f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,9 +1,6 @@ - + - - src/ - @@ -22,4 +19,9 @@ + + + src/ + + diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index f5e279d..0000000 --- a/psalm.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/rector.php b/rector.php index 28056f6..fc42cee 100644 --- a/rector.php +++ b/rector.php @@ -2,10 +2,8 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector; use Rector\Config\RectorConfig; -use Rector\Laravel\Set\LaravelSetList; -use Rector\Php74\Rector\Property\TypedPropertyRector; +use RectorLaravel\Set\LaravelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\SetList; @@ -16,18 +14,10 @@ __DIR__ . '/tests', ]); - $config->skip([ExplicitMethodCallOverMagicGetSetRector::class]); - // Define what rule sets will be applied $config->import(PHPUnitSetList::PHPUNIT_91); - $config->import(LaravelSetList::LARAVEL_80); + $config->import(LaravelSetList::LARAVEL_90); $config->import(SetList::CODE_QUALITY); $config->import(SetList::DEAD_CODE); - $config->import(SetList::PHP_80); - - // get services (needed for register a single rule) - $services = $config->services(); - - // register a single rule - $services->set(TypedPropertyRector::class); + $config->import(SetList::PHP_81); }; diff --git a/tests/Infra/Factories/BuyerFactory.php b/tests/Infra/Factories/BuyerFactory.php index 60d4af1..75a449d 100644 --- a/tests/Infra/Factories/BuyerFactory.php +++ b/tests/Infra/Factories/BuyerFactory.php @@ -14,8 +14,10 @@ final class BuyerFactory extends Factory public function definition(): array { return [ - 'name' => $this->faker->name, - 'email' => $this->faker->unique() + 'name' => fake() + ->name(), + 'email' => fake() + ->unique() ->safeEmail, ]; } diff --git a/tests/Infra/Models/Buyer.php b/tests/Infra/Models/Buyer.php index 78506bf..53f0afa 100644 --- a/tests/Infra/Models/Buyer.php +++ b/tests/Infra/Models/Buyer.php @@ -4,14 +4,25 @@ namespace Bavix\WalletUuid\Test\Infra\Models; +use Bavix\Wallet\Interfaces\Customer; +use Bavix\Wallet\Traits\CanPay; +use Bavix\Wallet\Traits\HasWallets; use Bavix\WalletUuid\Test\Infra\Uuids; +use Illuminate\Database\Eloquent\Model; /** * @internal */ -final class Buyer extends \Bavix\Wallet\Test\Infra\Models\Buyer +final class Buyer extends Model implements Customer { use Uuids; + use CanPay; + use HasWallets; public $incrementing = false; + + public function getTable(): string + { + return 'users'; + } }