Skip to content

Migrate to PHP 8.4 (Ouzo 4.0.0)#334

Merged
bbankowski merged 26 commits into
masterfrom
feature/php-8.4-migration
Apr 28, 2026
Merged

Migrate to PHP 8.4 (Ouzo 4.0.0)#334
bbankowski merged 26 commits into
masterfrom
feature/php-8.4-migration

Conversation

@bbankowski

@bbankowski bbankowski commented Apr 27, 2026

Copy link
Copy Markdown
Member

Context/Problem

Ouzo 3.x targets PHP 8.2 with dependencies that have reached end-of-life (Symfony 5.4, PHPUnit 10, PSR-3 v1). This PR migrates the framework to PHP 8.4 and bumps the major version to 4.0.0.

Solution/What changed

  • Dependencies upgraded: Symfony Console/EventDispatcher ^5.4→^7.2, PSR-3 ^1.1→^3.0, PHPUnit ^10.2→^11.5, whoops ^2.15→^2.18, proxy-manager-lts 1.0.16→^1.0.19, php-coveralls ^2.5→^2.9
  • Removed abandoned doctrine/annotations — code already uses PHP 8 native attributes
  • Fixed all PHP 8.4 deprecations: implicit nullable types (25+ files), E_STRICT constant removal
  • Fixed Model::jsonSerialize() to comply with JsonSerializable contract — returns mixed (attributes array) instead of JSON string
  • Fixed DynamicProxy code generation to produce explicit nullable types
  • Adapted to Symfony Console 7: Command::execute() returns int, MigrationCommand method signatures updated
  • Adapted to PSR-3 v3: Logger classes use string|Stringable $message signatures
  • Adopted PHP 8.4 features: new without parentheses, native #[Deprecated] attribute (replacing JetBrains #[Deprecated] and trigger_error)
  • Used native array_find, array_any, array_all in Arrays utility class
  • Updated README files and CHANGELOG for 4.0.0 release

Examples

All 1764 tests pass on PHP 8.4.20 with zero errors/failures:

Tests: 1764, Assertions: 3303, Skipped: 10

🤖 Generated with Claude Code

@bbankowski bbankowski self-assigned this Apr 27, 2026
bbankowski and others added 11 commits April 27, 2026 15:42
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- symfony/console ^5.4 -> ^7.2, symfony/event-dispatcher ^5.4 -> ^7.2
- psr/log ^1.1 -> ^3.0, filp/whoops ^2.15 -> ^2.18
- friendsofphp/proxy-manager-lts 1.0.16 -> ^1.0.19
- phpunit/phpunit ^10.2 -> ^11.5, php-coveralls ^2.5 -> ^2.9
- Remove abandoned doctrine/annotations (unused in src/)
- Platform PHP 8.2.7 -> 8.4.0

Adapt code to new dependency APIs:
- Add :int return type to Command::execute() (Symfony Console 7)
- Add return types to MigrationCommand methods
- Update Logger classes for PSR-3 v3 (string|Stringable)
- Fix DbTransactionalTestCase tearDown for PHPUnit 11
- Remove Doctrine AnnotationReader from tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Convert all implicit nullable parameters to explicit nullable
  types (?Type or Type|null) across 20 files in src/
- Fix DynamicProxy code generation to produce explicit nullable
  types in generated proxy classes
- Remove deprecated E_STRICT constant from ErrorHandler

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return attributes array instead of json_encode() result. The previous
implementation caused double-encoding when used with json_encode($model).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove redundant parentheses around new when chaining method calls
- Replace JetBrains #[Deprecated] with native PHP 8.4 attribute
  in ViewHelper and FormHelper
- Replace trigger_error(E_USER_DEPRECATED) with #[Deprecated]
  in Arrays::removeNestedValue()
- Add #[Deprecated] to Strings::EMPTY_STRING

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual foreach loops in Arrays::find(), Arrays::any()
and Arrays::all() with native PHP 8.4 functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- README.md: require PHP 8.4, update version support table
- Goodies/README.md: require PHP 8.4, update version support table
- Inject/README.md: add PHP 8.4 requirement
- CHANGELOG.md: add Release 4.0.0 section, close 3.0.0
- CLAUDE.md: update PHP version

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- PHP 8.2.7 -> 8.4
- PostgreSQL 10 -> 16 (10 is EOL)
- actions/checkout@v2 -> @v4
- Fix --exclude-group to use separate flags (PHPUnit 11)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Travis CI has not been used since migration to GitHub Actions.
Also removed Travis CI badge from README files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bbankowski bbankowski force-pushed the feature/php-8.4-migration branch from 50a6d8e to f6c80fa Compare April 27, 2026 13:44
bbankowski and others added 8 commits April 27, 2026 15:49
- BootstrapTest: restore error/exception handlers in tearDown
  after tests that call runApplication()
- ArraysTest: replace obsolete trigger_error assertion with
  delegation test for deprecated removeNestedValue()
- CLAUDE.md: add code style rule for use imports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document import ordering, type declarations, string/array syntax,
docblock policy, class design rules, error handling patterns,
and testing conventions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- TestCase::__construct() is final in PHPUnit 13, move initialization
  from constructors to setUp() in ControllerTestCase and BootstrapTest
- Add <testsuites> to phpunit.xml (required in PHPUnit 13)
- Replace deprecated <coverage> with <source> element
- Platform PHP 8.4.0 -> 8.4.1 (PHPUnit 13 requirement)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In global namespace blocks, built-in classes like Deprecated are
already in scope — importing them triggers a PHP warning about
non-compound use statements having no effect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The <source> element triggers a warning when no coverage driver
(xdebug/pcov) is loaded. Set failOnWarning=false to prevent
this from causing a non-zero exit code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Install pcov driver for PostgreSQL job (coverage runs once, not 3x)
- Add --coverage-clover flag to PHPUnit when coverage is enabled
- Skip coverage driver installation for MySQL/SQLite jobs (faster)
- Remove redundant 'test' argument (phpunit.xml has testsuites)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove php-coveralls dependency (and transitive guzzle/psr-http)
- Remove Coveralls badge from README
- Generate coverage HTML report as downloadable GHA artifact (14 days)
- Print coverage % summary in GitHub Actions job summary
- Coverage runs only on PostgreSQL job (pcov driver)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 84.665% (-1.2%) from 85.822% — feature/php-8.4-migration into master

@bbankowski bbankowski requested a review from piotrooo April 27, 2026 14:02
bbankowski and others added 6 commits April 28, 2026 09:49
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update Dockerfile-postgres and CI workflow from postgres:10/16 to postgres:18
- Fix start_environment.sh: replace hardcoded pg_isready path with generic command
- Make DB_HOST configurable via env var in test config (needed for Docker networking)
- Fix run_ci_tests.sh: add --link and DB_HOST for container connectivity
- Remove --verbose flag removed in PHPUnit 13
- Remove <groups> exclusion from phpunit.xml (non-functional in PHPUnit 13)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update minimum version constraint for symfony/console and
symfony/event-dispatcher from ^7.2 to ^7.4.8.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The script was a legacy local runner predating GitHub Actions CI
and is not referenced anywhere.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restricts updates to patch versions only (>=7.4.8, <7.5.0).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restrict all package updates to patch versions only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bbankowski bbankowski merged commit 147d9d4 into master Apr 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants