Skip to content

Drop doctrine/orm 2 support - #86

Merged
sylfabre merged 1 commit into
mainfrom
sylvain_drop-orm2-support
Aug 21, 2026
Merged

Drop doctrine/orm 2 support#86
sylfabre merged 1 commit into
mainfrom
sylvain_drop-orm2-support

Conversation

@sylfabre

@sylfabre sylfabre commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Why

All applications consuming this bundle now run doctrine/orm 3, so the ORM 2 compatibility layer is dead weight.

Changes

  • composer.json: doctrine/orm constraint narrowed from ^2.20|^3.0 to ^3.0.
  • EntityValidator:
    • field mappings are always ORM 3 FieldMapping objects now — the is_array() detection is gone, get_object_vars() keeps normalizing to the array shape providers expect;
    • association handling rewritten on ORM 3's semantic helpers (isToOneOwningSide() / isOwningSide()) instead of the ORM 2 array branch + bitmask checks, removing the extractAssociationMappingValues() tuple helper and its @codeCoverageIgnore;
    • the DomainException('Unknown type') branch is removed: ORM 3's AssociationMapping::type() is final and can only return one of the four known constants, so the branch was unreachable dead code.
  • FieldConstraintsSetProviderInterface: contract docblock updated (no more "ORM 2 array shape" wording).
  • Tests: the mock metadata now uses real ORM 3 mapping objects (FieldMapping, EmbeddedClassMapping, association mapping classes); the ORM 3-specific duplicate tests, the skipUnlessOrm3() guard and the unknown-type test (dead branch) are removed.
  • phpstan.neon.dist: all dual-major ignore rules and reportUnmatchedIgnoredErrors: false are removed; one narrow argument.type ignore remains for the minimal test fixture arrays fed to fromMappingArray().

Net: −155 lines.

Validation

Ran in a PHP 8.4 container with highest deps: composer validate --strict, PHPUnit (287 tests OK, 4 expected skips), PHPStan (0 errors), PHPCS (clean), Rector dry-run (clean).

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

1 similar comment
@sonarqubecloud

Copy link
Copy Markdown

@sylfabre
sylfabre merged commit ad01441 into main Aug 21, 2026
5 checks passed
@sylfabre
sylfabre deleted the sylvain_drop-orm2-support branch August 21, 2026 14:05
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