From a9a2d48c217a8921abadd9703189c181722074b0 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:02:44 +0400 Subject: [PATCH 1/4] [#220] Require PHP 8.2 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/php.yml | 2 +- .scrutinizer.yml | 2 +- CHANGELOG.md | 5 +++++ README.md | 2 +- composer.json | 2 +- phpstan.neon.dist | 2 +- rector.php | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 305016a..a8a11e4 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest ] - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4'] runs-on: ${{ matrix.operating-system }} diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 3d703a6..c239586 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ build: environment: php: - version: 8.1 + version: 8.2 dependencies: before: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b4b6da..771d0e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning. +## [Unreleased] + +### Changed +- **BREAKING:** PHP 8.2 or newer is required, as for quantum/framework 3.2: `composer.json` requires `php` `^8.2`, CI tests PHP 8.2, 8.3 and 8.4, and PHPStan and Rector target PHP 8.2. Projects on PHP 8.1 stay on 3.1.x (#220). + ## [3.1.2] - 2026-11-19 ### Added diff --git a/README.md b/README.md index 1e71f43..69f2619 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@

Installation

-

Requirements: PHP 8.1 or newer.

+

Requirements: PHP 8.2 or newer.

1. Create new project

diff --git a/composer.json b/composer.json index e1e0048..9f3c4ca 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "type": "project", "require": { - "php": "^8.1", + "php": "^8.2", "quantum/framework": "^3.1.2", "fakerphp/faker": "^1.15", "bluemmb/faker-picsum-photos-provider": "^2.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6870cdb..2ec8f03 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ parameters: - phpVersion: 80100 + phpVersion: 80200 level: 5 paths: - shared diff --git a/rector.php b/rector.php index 6a2a654..36a32cb 100644 --- a/rector.php +++ b/rector.php @@ -20,7 +20,7 @@ ClassPropertyAssignToConstructorPromotionRector::class, ]) ->withSets([ - LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_82, SetList::TYPE_DECLARATION, ]) ->withRules([ From b6f5c00abff0ad2baa3fa480dfea6e151a82190e Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:09:29 +0400 Subject: [PATCH 2/4] [#220] Require quantum/framework 3.2 and Symfony 7.4 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + composer.json | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 771d0e4..5a1b812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver ### Changed - **BREAKING:** PHP 8.2 or newer is required, as for quantum/framework 3.2: `composer.json` requires `php` `^8.2`, CI tests PHP 8.2, 8.3 and 8.4, and PHPStan and Rector target PHP 8.2. Projects on PHP 8.1 stay on 3.1.x (#220). +- **BREAKING:** `symfony/process` and `symfony/yaml` are updated to `^7.4` (they were `^5.4`), because the framework's `symfony/console` 7.4 conflicts with `symfony/process` below 6.4. A project that uses `symfony/process` or `symfony/yaml` directly gets their 7.4 versions (#220). ## [3.1.2] - 2026-11-19 diff --git a/composer.json b/composer.json index 9f3c4ca..c5e8ea8 100644 --- a/composer.json +++ b/composer.json @@ -26,12 +26,12 @@ "type": "project", "require": { "php": "^8.2", - "quantum/framework": "^3.1.2", + "quantum/framework": "3.2.*@dev", "fakerphp/faker": "^1.15", "bluemmb/faker-picsum-photos-provider": "^2.0", "ottaviano/faker-gravatar": "^0.3.0", - "symfony/process": "^5.4", - "symfony/yaml": "^5.4.52" + "symfony/process": "^7.4", + "symfony/yaml": "^7.4" }, "require-dev": { "phpunit/phpunit": "^9.0", From a01ebf3732ee67f2b2f8210181fea0b892ef4b24 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:15:33 +0400 Subject: [PATCH 3/4] [#220] Update phpunit/phpunit to 11.5 and mockery/mockery to 1.6 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + composer.json | 4 +-- phpunit.xml | 1 - tests/Feature/AppTestCase.php | 36 ++++++++++++++++++++++- tests/Unit/shared/Lang/CommonLangTest.php | 13 +++----- 5 files changed, 42 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a1b812..3261925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver ### Changed - **BREAKING:** PHP 8.2 or newer is required, as for quantum/framework 3.2: `composer.json` requires `php` `^8.2`, CI tests PHP 8.2, 8.3 and 8.4, and PHPStan and Rector target PHP 8.2. Projects on PHP 8.1 stay on 3.1.x (#220). - **BREAKING:** `symfony/process` and `symfony/yaml` are updated to `^7.4` (they were `^5.4`), because the framework's `symfony/console` 7.4 conflicts with `symfony/process` below 6.4. A project that uses `symfony/process` or `symfony/yaml` directly gets their 7.4 versions (#220). +- The tests run on PHPUnit `^11.5` (it was `^9.0`) and Mockery `^1.6` (development dependencies). `phpunit.xml` drops the `verbose` attribute, which PHPUnit 11 no longer accepts, the tests use the `#[DataProvider]` attribute instead of the `@dataProvider` doc comment, and the feature tests tear down the app they boot in `setUp()`, together with the framework's error and exception handlers (#220). ## [3.1.2] - 2026-11-19 diff --git a/composer.json b/composer.json index c5e8ea8..e361f05 100644 --- a/composer.json +++ b/composer.json @@ -34,8 +34,8 @@ "symfony/yaml": "^7.4" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "mockery/mockery": "^1.2", + "phpunit/phpunit": "^11.5", + "mockery/mockery": "^1.6", "friendsofphp/php-cs-fixer": "^3.94", "rector/rector": "^2.3", "phpstan/phpstan": "^2.1" diff --git a/phpunit.xml b/phpunit.xml index 6e77e94..84995c0 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,7 +4,6 @@ xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="tests/bootstrap.php" colors="true" - verbose="true" stderr="true" stopOnFailure="false" > diff --git a/tests/Feature/AppTestCase.php b/tests/Feature/AppTestCase.php index f902733..c6501f1 100644 --- a/tests/Feature/AppTestCase.php +++ b/tests/Feature/AppTestCase.php @@ -2,11 +2,15 @@ namespace Quantum\Tests\Feature; +use Quantum\App\Factories\AppFactory; +use Quantum\Tracer\ErrorHandler; use PHPUnit\Framework\TestCase; use Quantum\App\Enums\AppType; use Quantum\Http\Response; -use Quantum\App\App; +use ReflectionFunction; use RuntimeException; +use Quantum\App\App; +use Closure; class AppTestCase extends TestCase { @@ -33,6 +37,8 @@ public function setUp(): void public function tearDown(): void { $this->clearRateLimitStorage(); + AppFactory::destroy(AppType::WEB); + $this->removeFrameworkErrorHandlers(); parent::tearDown(); ob_end_clean(); } @@ -59,6 +65,34 @@ protected function signInAndGetTokens(): array return $response->get('tokens'); } + /** + * Removes the error and exception handlers that the framework's ErrorHandler registered + * when setUp() booted the app; the handlers of the console app that tests/bootstrap.php + * boots once stay in place + */ + private function removeFrameworkErrorHandlers(): void + { + $isFrameworkHandler = $this->isFrameworkHandler(set_error_handler(static fn (): bool => false)); + restore_error_handler(); + + if ($isFrameworkHandler) { + restore_error_handler(); + } + + $isFrameworkHandler = $this->isFrameworkHandler(set_exception_handler(static function (): void { + })); + restore_exception_handler(); + + if ($isFrameworkHandler) { + restore_exception_handler(); + } + } + + private function isFrameworkHandler(mixed $handler): bool + { + return $handler instanceof Closure && (new ReflectionFunction($handler))->getClosureThis() instanceof ErrorHandler; + } + private function clearRateLimitStorage(): void { $rateLimitDir = PROJECT_ROOT . DS . 'cache' . DS . 'data'; diff --git a/tests/Unit/shared/Lang/CommonLangTest.php b/tests/Unit/shared/Lang/CommonLangTest.php index ac6747c..899bd9b 100644 --- a/tests/Unit/shared/Lang/CommonLangTest.php +++ b/tests/Unit/shared/Lang/CommonLangTest.php @@ -2,6 +2,7 @@ namespace Quantum\Tests\Unit\shared\Lang; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class CommonLangTest extends TestCase @@ -31,9 +32,7 @@ class CommonLangTest extends TestCase 'token', ]; - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testEveryLanguageHasTheStarTexts(string $language): void { $star = $this->texts($language, 'pages')['star'] ?? null; @@ -64,9 +63,7 @@ public function testEnglishTextAsksForAStarOnGitHub(): void $this->assertSame('GitHub stars', $star['badge_alt'] ?? null); } - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testCommonKeepsTheKeysTheFrameworkReadsByName(string $language): void { $keys = $this->flatten($this->texts($language, 'common')); @@ -79,9 +76,7 @@ public function testCommonKeepsTheKeysTheFrameworkReadsByName(string $language): $this->assertSame([], array_values(array_diff(array_keys($keys), self::COMMON_KEYS))); } - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testCommentMessagesAreTranslated(string $language): void { $comments = $this->texts($language, 'comments'); From f3d6bf12919a19d5ac913c2bb2436d1a7da43540 Mon Sep 17 00:00:00 2001 From: Arman <407448+armanist@users.noreply.github.com> Date: Sat, 21 Nov 2026 21:27:20 +0400 Subject: [PATCH 4/4] [#220] Name the coverage source in phpunit.xml PHPUnit 11 needs a source filter for the coverage report that composer test writes, and fails the run without one. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- phpunit.xml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3261925..255d965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver ### Changed - **BREAKING:** PHP 8.2 or newer is required, as for quantum/framework 3.2: `composer.json` requires `php` `^8.2`, CI tests PHP 8.2, 8.3 and 8.4, and PHPStan and Rector target PHP 8.2. Projects on PHP 8.1 stay on 3.1.x (#220). - **BREAKING:** `symfony/process` and `symfony/yaml` are updated to `^7.4` (they were `^5.4`), because the framework's `symfony/console` 7.4 conflicts with `symfony/process` below 6.4. A project that uses `symfony/process` or `symfony/yaml` directly gets their 7.4 versions (#220). -- The tests run on PHPUnit `^11.5` (it was `^9.0`) and Mockery `^1.6` (development dependencies). `phpunit.xml` drops the `verbose` attribute, which PHPUnit 11 no longer accepts, the tests use the `#[DataProvider]` attribute instead of the `@dataProvider` doc comment, and the feature tests tear down the app they boot in `setUp()`, together with the framework's error and exception handlers (#220). +- The tests run on PHPUnit `^11.5` (it was `^9.0`) and Mockery `^1.6` (development dependencies). `phpunit.xml` drops the `verbose` attribute, which PHPUnit 11 no longer accepts, and names `shared` as the source for code coverage, which PHPUnit 11 requires for `composer test`, the tests use the `#[DataProvider]` attribute instead of the `@dataProvider` doc comment, and the feature tests tear down the app they boot in `setUp()`, together with the framework's error and exception handlers (#220). ## [3.1.2] - 2026-11-19 diff --git a/phpunit.xml b/phpunit.xml index 84995c0..d6359f1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -15,4 +15,9 @@ ./tests/Unit + + + ./shared + + \ No newline at end of file