From e31e63200ff920395137bcb23c71755fea278a00 Mon Sep 17 00:00:00 2001 From: Takuma Kajikawa Date: Tue, 7 Jul 2026 13:05:24 +0900 Subject: [PATCH 1/2] feat: support PHP 8.3 The library uses nothing newer than readonly classes (8.2) and the #[Override] attribute (8.3), so the ^8.4 platform requirement was stricter than necessary and limited adoption. - composer.json: php ^8.4 -> ^8.3 - phpstan.neon: phpVersion min 80400 -> 80300 (analysis passes with the 8.3 language/stdlib surface) - CI: add 8.3 to the test, phpstan and code-style matrices - README: update the requirements section phpunit 12.5 and php-cs-fixer 3.95 both support PHP 8.3. Claude-Session: https://claude.ai/code/session_017XTM7pxbWPVNLV639i5WgK --- .github/workflows/code-style.yml | 2 +- .github/workflows/phpstan.yml | 2 +- .github/workflows/test.yml | 2 +- README.md | 2 +- composer.json | 2 +- phpstan.neon | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index d27f9b3..54b7732 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - php-version: ['8.4', '8.5'] + php-version: ['8.3', '8.4', '8.5'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 747f442..9f1a22d 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - php-version: ['8.4', '8.5'] + php-version: ['8.3', '8.4', '8.5'] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2d9885..eb167e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.4', '8.5'] + php: ['8.3', '8.4', '8.5'] steps: - name: Checkout diff --git a/README.md b/README.md index f28649f..22c1921 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ composer require valbeat/result ## Requirements -- PHP 8.4 or higher (tested on PHP 8.4 and 8.5) +- PHP 8.3 or higher (tested on PHP 8.3, 8.4 and 8.5) - Composer ## Basic Usage diff --git a/composer.json b/composer.json index e07f270..e806971 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^8.4" + "php": "^8.3" }, "require-dev": { "phpstan/phpstan": "2.2.5", diff --git a/phpstan.neon b/phpstan.neon index ed05d1a..df6b243 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,7 +13,7 @@ parameters: checkBenevolentUnionTypes: true checkUninitializedProperties: true - # Supported PHP versions (8.4 - 8.5) + # Supported PHP versions (8.3 - 8.5) phpVersion: - min: 80400 + min: 80300 max: 80500 \ No newline at end of file From b3930b4f72fc9d62cfdffc7bf1c5db8329c30e77 Mon Sep 17 00:00:00 2001 From: Takuma Kajikawa Date: Tue, 7 Jul 2026 13:34:32 +0900 Subject: [PATCH 2/2] fix: make php-cs-fixer config and CI caches PHP 8.3 compatible Code review of this PR found the 8.3 CI jobs red: - .php-cs-fixer.dist.php used PHP 8.4-only parenthesless-new method chaining (new PhpCsFixer\Config()->setRules(...)), a hard parse error on PHP 8.3. Wrap in parentheses. - Switch @PHP84Migration to @PHP83Migration so cs-fix can never rewrite code into 8.4-only forms while composer.json says ^8.3 (no reformatting results from the switch today). - Vendor cache keys hashed the gitignored composer.lock (always empty), so all matrix PHP versions shared one 'Linux-php-' cache. Key on the PHP version and composer.json hash instead. Claude-Session: https://claude.ai/code/session_017XTM7pxbWPVNLV639i5WgK --- .github/workflows/code-style.yml | 4 ++-- .github/workflows/phpstan.yml | 4 ++-- .php-cs-fixer.dist.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 54b7732..f4243bb 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -28,9 +28,9 @@ jobs: uses: actions/cache@v3 with: path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php- + ${{ runner.os }}-php-${{ matrix.php-version }}- - name: Install dependencies run: composer install --prefer-dist --no-progress diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 9f1a22d..d3ccece 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -32,9 +32,9 @@ jobs: uses: actions/cache@v3 with: path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php- + ${{ runner.os }}-php-${{ matrix.php-version }}- - name: Install dependencies run: composer install --prefer-dist --no-progress diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index bf1062e..f8a3dc7 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,10 +11,10 @@ ->ignoreDotFiles(true) ->ignoreVCS(true); -return new PhpCsFixer\Config() +return (new PhpCsFixer\Config()) ->setRules([ '@PSR12' => true, - '@PHP84Migration' => true, + '@PHP83Migration' => true, 'array_syntax' => ['syntax' => 'short'], 'blank_line_after_namespace' => true, 'blank_line_after_opening_tag' => true,