From 9da722ef6a49c71864523c5c4dddb235bf20f16b Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Wed, 12 Jun 2024 05:53:57 -0700 Subject: [PATCH] Support PHP 8.3 (#21) --- .circleci/config.yml | 8 ++++---- composer.json | 2 +- rector.php | 30 +++++------------------------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d6bf81..373dfbc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -141,7 +141,7 @@ jobs: tag: << parameters.version >> parameters: version: - default: "7.4" + default: "8.3" description: The `cimg/php` Docker image version tag. type: string install-flags: @@ -154,7 +154,7 @@ jobs: - when: condition: and: - - equal: [ "8.1", <> ] + - equal: [ "8.3", <> ] - equal: [ "", <> ] steps: - run-phpunit-tests: @@ -164,7 +164,7 @@ jobs: condition: not: and: - - equal: [ "8.1", <> ] + - equal: [ "8.3", <> ] - equal: [ "", <> ] steps: - run-phpunit-tests: @@ -176,5 +176,5 @@ workflows: - matrix-conditions: matrix: parameters: - version: ["8.2", "8.1", "8.0", "7.4"] + version: ["8.3", "8.2", "8.1", "8.0", "7.4"] install-flags: ["", "--prefer-lowest"] diff --git a/composer.json b/composer.json index 7ebb94d..01bc304 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "php": ">=7.4", "ext-json": "*", "fmizzell/maquina": "^1.1.1", - "getdkan/contracts": "^1.1.2" + "getdkan/contracts": "^1.1.3" }, "require-dev": { "phpunit/phpunit": "^9.6", diff --git a/rector.php b/rector.php index e9fd419..1ba3e10 100644 --- a/rector.php +++ b/rector.php @@ -3,44 +3,24 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; -use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector; -use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector; -use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector; -use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Set\ValueObject\SetList; -use Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector; -use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ - __DIR__ . '/src', - __DIR__ . '/test', + __DIR__ . '/src', + __DIR__ . '/test', + __DIR__ . '/rector.php', ]); - // Our base version of PHP. - $rectorConfig->phpVersion(PhpVersion::PHP_74); - $rectorConfig->sets([ - SetList::PHP_82, + SetList::PHP_74, // Please no dead code or unneeded variables. SetList::DEAD_CODE, // Try to figure out type hints. SetList::TYPE_DECLARATION, ]); - $rectorConfig->skip([ - // Don't throw errors on JSON parse problems. Yet. - // @todo Throw errors and deal with them appropriately. - JsonThrowOnErrorRector::class, - // We like our tags. Please don't remove them. - RemoveUselessParamTagRector::class, - RemoveUselessReturnTagRector::class, - RemoveUselessVarTagRector::class, - ArrayShapeFromConstantArrayReturnRector::class, - AddMethodCallBasedStrictParamTypeRector::class, - ]); - + $rectorConfig->removeUnusedImports(); $rectorConfig->importNames(); $rectorConfig->importShortClasses(false); };