From 9aeb440cb0bad149b2218a4d028b55c08d54c8aa Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Tue, 3 Jan 2023 16:15:33 +0000 Subject: [PATCH] feat: require PHP 8.2 or later --- .github/workflows/phpstan.yml | 2 +- .github/workflows/run-tests.yml | 10 ++-------- .php-cs-fixer.dist.php | 21 --------------------- composer.json | 22 ++++++++-------------- ecs.php | 17 +++++++++++++++++ phpcs.xml | 32 -------------------------------- rector.php | 23 +++++++++++++++++++++++ tests/TranslatorManagerTest.php | 8 ++++++-- 8 files changed, 57 insertions(+), 78 deletions(-) delete mode 100644 .php-cs-fixer.dist.php create mode 100644 ecs.php delete mode 100644 phpcs.xml create mode 100644 rector.php diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index ec2e150..e5cf42d 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.2' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 290acc2..650d97e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -15,14 +15,9 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.0, 8.1] - laravel: [8.*, 9.*] + php: [8.2] + laravel: [9.*] stability: [prefer-lowest, prefer-stable] - include: - - laravel: 8.* - testbench: ^6.23 - - laravel: 9.* - testbench: ^7.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -44,7 +39,6 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --ansi composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ansi - name: Execute tests diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index da138a6..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,21 +0,0 @@ -in(__DIR__.'/src') - ->in(__DIR__.'/tests') - ->in(__DIR__.'/config'); - -return PhpCsFixerConfig::make() - ->setFinder($finder) - ->setRules([ - '@worksome' => true, - '@worksome:risky' => true, - ]) - ->setRiskyAllowed(true); diff --git a/composer.json b/composer.json index a952a00..7d68e43 100644 --- a/composer.json +++ b/composer.json @@ -16,21 +16,21 @@ } ], "require": { - "php": "^8.0|^8.1", + "php": "^8.2", "google/cloud-translate": "^1.12", - "illuminate/support": "^8.83|^9.0", + "illuminate/support": "^9.46", "spatie/laravel-package-tools": "^1.11.3" }, "require-dev": { "guzzlehttp/guzzle": "^7.4", - "nunomaduro/collision": "^5.11|^6.0", - "nunomaduro/larastan": "^1.0.3 || ^2.0", - "orchestra/testbench": "^6.24|^7.0", + "nunomaduro/collision": "^6.0", + "nunomaduro/larastan": "^2.2", + "orchestra/testbench": "^7.0", "pestphp/pest": "^1.21", "pestphp/pest-plugin-laravel": "^1.2", "pestphp/pest-plugin-parallel": "^1.0", "spatie/laravel-ray": "^1.29", - "worksome/coding-style": "^0.16.0", + "worksome/coding-style": "^2.3.2", "worksome/pest-plugin-silence": "^0.1" }, "autoload": { @@ -44,17 +44,11 @@ } }, "scripts": { - "lint": [ - "vendor/bin/php-cs-fixer fix --ansi", - "vendor/bin/phpcbf" - ], + "lint": "vendor/bin/ecs --fix", "test:unit": "vendor/bin/pest -p", "test:coverage": "vendor/bin/pest -p --coverage", "test:types": "vendor/bin/phpstan analyse", - "test:style": [ - "vendor/bin/php-cs-fixer fix --dry-run --ansi", - "vendor/bin/phpcs -n" - ], + "test:style": "vendor/bin/ecs", "test": [ "@test:style", "@test:types", diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..1916269 --- /dev/null +++ b/ecs.php @@ -0,0 +1,17 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + __DIR__ . '/config', + ]); + + WorksomeEcsConfig::setup($ecsConfig); +}; diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 85659cb..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - Worksome Coding Standard - - ./src - ./tests - ./config - - - - - - - - - .*Test.php - - - - - - - - - */*.blade.php - - - - - - - diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..e1706e6 --- /dev/null +++ b/rector.php @@ -0,0 +1,23 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // Define extra rule sets to be applied + $rectorConfig->sets([ + // SetList::DEAD_CODE, + ]); + + // Register extra a single rules + // $rectorConfig->rule(ClassOnObjectRector::class); +}; diff --git a/tests/TranslatorManagerTest.php b/tests/TranslatorManagerTest.php index 4d22e2f..1c5b431 100644 --- a/tests/TranslatorManagerTest.php +++ b/tests/TranslatorManagerTest.php @@ -28,7 +28,9 @@ ->toBeInstanceOf(NullDriver::class) ->translate('This is being translated', 'en', 'en') ->toBeInstanceOf(TranslationDTO::class) - ->toEqual(new TranslationDTO(source: 'en', input: 'This is being translated', text: 'This is being translated')); + ->toEqual( + new TranslationDTO(source: 'en', input: 'This is being translated', text: 'This is being translated') + ); }); it('can detect input language using the null driver', function () { @@ -50,5 +52,7 @@ expect($provider) ->toBeInstanceOf(TranslationDTO::class) - ->toEqual(new TranslationDTO(source: 'en', input: 'This is being translated', text: 'This is being translated')); + ->toEqual( + new TranslationDTO(source: 'en', input: 'This is being translated', text: 'This is being translated') + ); });