Skip to content

feat: add PHP 8.4 and Symfony 8 support - #2

Open
Nohty wants to merge 1 commit into
lambstream:masterfrom
Nohty:feat/php-8.4-symfony-8-support
Open

Nohty wants to merge 1 commit into
lambstream:masterfrom
Nohty:feat/php-8.4-symfony-8-support

Conversation

@Nohty

@Nohty Nohty commented Nov 21, 2026

Copy link
Copy Markdown

Problem / Why

Add support for PHP 8.4 and Symfony 8 (^8.0) while keeping full backwards compatibility with PHP >=8.1 and Symfony ^6.1 || ^7.0.

What changed

  • Composer constraints (composer.json): Added || ^8.0 to all 7 symfony/* dependencies (^6.1 || ^7.0 || ^8.0) and bumped phpunit/phpunit to ^9.6.21 (first PHPUnit 9 release compatible with PHP 8.4).
  • Symfony 8 compatibility:
    • Switched DZunkeFeatureFlagsExtension from the internal/deprecated Symfony\Component\HttpKernel\DependencyInjection\Extension to Symfony\Component\DependencyInjection\Extension\Extension.
    • Updated DebugFlagsCommand to use the #[AsCommand] attribute and return Command::SUCCESS.
  • PHP 8.4 compatibility & test fix:
    • Replaced 100 * (mt_rand(...) / mt_getrandmax()) with random_int(0, 99) in Percentage::generateRandomNumber() to eliminate the PHP 8.1–8.4 float-to-int implicit conversion deprecation, and explicitly cast the cookie value to (string) in setcookie().
    • Updated PercentageTest to use Symfony\Component\HttpFoundation\InputBag (matching Request::$cookies's typed InputBag property) and isolated the unset-cookie test with @runInSeparateProcess and @preserveGlobalState disabled.

Verification

Verified locally in Docker (php:8.4-cli, PHP 8.4.28):

  • php -l across all .php files: 0 syntax errors.
  • ./vendor/bin/phpunit -v on Symfony ^8.0 (highest & lowest), ^7.0 (highest), and ^6.1 (highest & lowest): OK (40 tests, 77 assertions) in all configurations.
  • Runtime smoke check booting DZunkeFeatureFlagsBundle, compiling the DI container, evaluating a flag, and inspecting DebugFlagsCommand: passed on Symfony 8.1.11, 7.4.23, and 6.4.50.

Keep PHP >=8.1 and Symfony ^6.1 || ^7.0 compatibility while adding Symfony ^8.0 support, migrating DZunkeFeatureFlagsExtension to Symfony\Component\DependencyInjection\Extension\Extension, modernizing DebugFlagsCommand with #[AsCommand] and Command::SUCCESS, fixing the PHP 8.4 float-to-int deprecation in Percentage, fixing PercentageTest to use InputBag, and bumping phpunit/phpunit to ^9.6.21.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant