From ddbe563bbae4bfbc8d5a3e45c6db05ee6d3eabfc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 15:01:17 +0000 Subject: [PATCH 1/4] Add PHPUnit v13 support, drop v11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update phpunit/phpunit constraint from ^11 || ^12 to ^12 || ^13 - Add PHP 8.4 to CI test matrix (required by PHPUnit 13) PHPUnit 11 no longer receives bug fixes, while PHPUnit 13 (released Feb 2026) requires PHP 8.4+. The existing codebase is fully compatible with v13 — no source code or config changes needed. https://claude.ai/code/session_01N6BJAgbZC1FeeyzhMSoXgX --- .github/workflows/ci.yaml | 1 + composer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 860643a..21abcdc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,7 @@ jobs: php-version: - "8.2" - "8.3" + - "8.4" dependencies: - "highest" include: diff --git a/composer.json b/composer.json index b163b46..ad534c6 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^8.2", "league/construct-finder": "^1.4", - "phpunit/phpunit": "^11 || ^12" + "phpunit/phpunit": "^12 || ^13" }, "require-dev": { "cdn77/coding-standard": "^7.0", From 5804f87ac58274648e4006ebbcbf64fb6733c3c2 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 15:04:14 +0000 Subject: [PATCH 2/4] Drop PHP 8.2 support, add PHP 8.5 to CI matrix - Bump minimum PHP requirement from ^8.2 to ^8.3 - Update all CI workflows (ci, static-analysis, coding-standards, infection) from PHP 8.2 to 8.3 - Add PHP 8.5 to the CI test matrix https://claude.ai/code/session_01N6BJAgbZC1FeeyzhMSoXgX --- .github/workflows/ci.yaml | 4 ++-- .github/workflows/coding-standards.yaml | 2 +- .github/workflows/infection.yaml | 2 +- .github/workflows/static-analysis.yaml | 2 +- composer.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 21abcdc..4879240 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,14 +15,14 @@ jobs: strategy: matrix: php-version: - - "8.2" - "8.3" - "8.4" + - "8.5" dependencies: - "highest" include: - dependencies: "lowest" - php-version: "8.2" + php-version: "8.3" steps: - name: "Checkout" diff --git a/.github/workflows/coding-standards.yaml b/.github/workflows/coding-standards.yaml index ad945c7..6349ab0 100644 --- a/.github/workflows/coding-standards.yaml +++ b/.github/workflows/coding-standards.yaml @@ -19,7 +19,7 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.2" + php-version: "8.3" coverage: "none" tools: "cs2pr, pecl" diff --git a/.github/workflows/infection.yaml b/.github/workflows/infection.yaml index b7efdf5..4ada929 100644 --- a/.github/workflows/infection.yaml +++ b/.github/workflows/infection.yaml @@ -20,7 +20,7 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.2" + php-version: "8.3" coverage: "pcov" - name: "Install dependencies with Composer" diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml index 2b9533d..6039c51 100644 --- a/.github/workflows/static-analysis.yaml +++ b/.github/workflows/static-analysis.yaml @@ -19,7 +19,7 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.2" + php-version: "8.3" coverage: "none" tools: "cs2pr, pecl" diff --git a/composer.json b/composer.json index ad534c6..a1f410e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": "^8.2", + "php": "^8.3", "league/construct-finder": "^1.4", "phpunit/phpunit": "^12 || ^13" }, From bad484e59f0375ca8339568b5771bd68f213a4e8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 15:12:33 +0000 Subject: [PATCH 3/4] Fix test for PHP 8.4 readonly property change, disable fail-fast PHP 8.4 allows ReflectionProperty::setValue() to set readonly properties from any scope. Update testPublicReadonlyPropertyCannotBeSet to assert successful set on PHP 8.4+ while preserving the error expectation for PHP 8.3. Also disable fail-fast in CI matrix so all combinations run independently. https://claude.ai/code/session_01N6BJAgbZC1FeeyzhMSoXgX --- .github/workflows/ci.yaml | 1 + tests/StubTest.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4879240..15f9aa2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,7 @@ jobs: runs-on: "ubuntu-24.04" strategy: + fail-fast: false matrix: php-version: - "8.3" diff --git a/tests/StubTest.php b/tests/StubTest.php index c5bf365..24f3df9 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -67,9 +67,16 @@ public function testPrivateReadonlyPropertyIsSetBypassingConstructor(): void self::assertSame('value', $stub->parentReadonlyProperty()); } - /** PHP does not allow setting protected or public readonly properties from different scopes */ + /** PHP < 8.4 does not allow setting public readonly properties from different scopes */ public function testPublicReadonlyPropertyCannotBeSet(): void { + if (PHP_VERSION_ID >= 80400) { + $stub = Stub::create(ClassWithReadonlyProperty::class, ['parentPublicReadonlyProperty' => 'value']); + self::assertSame('value', $stub->parentPublicReadonlyProperty); + + return; + } + try { Stub::create(ClassWithReadonlyProperty::class, ['parentPublicReadonlyProperty' => 'value']); } catch (Error $e) { From 7ba92d573d503844f08b47b55a68ed7a4bf70a8a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Feb 2026 15:15:04 +0000 Subject: [PATCH 4/4] Remove deprecated setAccessible() calls, fix PHP_VERSION_ID import setAccessible() is a no-op since PHP 8.1 and deprecated in PHP 8.5. Remove both calls in Stub.php. Add explicit `use const PHP_VERSION_ID` import in StubTest to satisfy the coding standard requiring imports over fallback global names. https://claude.ai/code/session_01N6BJAgbZC1FeeyzhMSoXgX --- src/Stub.php | 2 -- tests/StubTest.php | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stub.php b/src/Stub.php index 6aee93b..306bda7 100644 --- a/src/Stub.php +++ b/src/Stub.php @@ -34,7 +34,6 @@ public static function create(string $class, array $properties = []): object throw new ReflectionException(sprintf('Property "%s" not found', $property)); } - $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($stub, $value); } @@ -59,7 +58,6 @@ public static function extend(object $stub, array $newProperties = []): object /** @var array $properties */ $properties = []; foreach (self::getAllProperties($reflection) as $property) { - $property->setAccessible(true); if (! $property->isInitialized($stub)) { continue; } diff --git a/tests/StubTest.php b/tests/StubTest.php index 24f3df9..e5cea84 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -9,6 +9,8 @@ use Error; use ReflectionException; +use const PHP_VERSION_ID; + final class StubTest extends BaseTestCase { public function testValueIsDefaultWhenNotSet(): void