Skip to content

feat(deps): drop doctrine/annotations - #320

Merged
deviantintegral merged 1 commit into
mainfrom
claude/drop-doctrine-annotations
Aug 11, 2026
Merged

feat(deps): drop doctrine/annotations#320
deviantintegral merged 1 commit into
mainfrom
claude/drop-doctrine-annotations

Conversation

@deviantintegral

Copy link
Copy Markdown
Owner

Removes doctrine/annotations from require.

Why it's safe

  • Nothing here uses annotations. All 69 serializer metadata declarations in src/ are PHP 8 attributes (#[Serializer\Type(...)], #[Serializer\PostDeserialize], …). There are zero docblock @Serializer annotations.
  • JMS doesn't need it on PHP 8. DefaultDriverFactory::createDriver() only throws the "doctrine/annotations must be installed" error when PHP_VERSION_ID < 80000. Above that it registers AnnotationOrAttributeDriver with a null reader, and that driver calls getAttributes(SerializerAttribute::class, IS_INSTANCEOF) unconditionally — the reader is only an extra array_merge when non-null. This package requires php: ^8.2, so that branch is unreachable.
  • Verified by removing it. Full suite passes with the package absent: 334 tests, 990 assertions. PHPStan clean, PHP-CS-Fixer clean, composer validate --strict passes, and composer install --no-dev (what the PHAR builds from) resolves.

Lock impact

The lock diff removes exactly two packages: doctrine/annotations and psr/cache (its only dependent here). doctrine/lexer stays, since jms/serializer requires it directly.

This library was the sole runtime requirerjms/serializer and deviantintegral/jms-serializer-uri-handler both list it under require-dev. So this genuinely uninstalls it downstream rather than leaving it behind transitively.

Compatibility note

No break to this library's own API or behavior. One downstream edge case is worth a release note: Serializer::getSerializerBuilder() is public API, so anyone who takes that builder and serializes their own docblock-annotated classes will silently lose that metadata (empty metadata via NullDriver) rather than get an error. Those consumers should add doctrine/annotations to their own composer.json.

Typed as feat so release-please cuts a minor and the entry is visible in the changelog. Retype to build/chore if you'd rather it be a hidden patch.

🤖 Generated with Claude Code

https://claude.ai/code/session_013DMMmSMemViyZXtmDwQgvk

All serializer metadata in src/ is declared with PHP 8 attributes
(#[Serializer\...]); there are no docblock @serializer annotations left.
JMS Serializer's DefaultDriverFactory only requires doctrine/annotations
below PHP 8.0 -- above that it registers AnnotationOrAttributeDriver with
a null reader, and that driver reads attributes via reflection
unconditionally. Since this package requires PHP ^8.2, the annotation
reader was never doing any work.

Nothing else in the dependency graph requires doctrine/annotations at
runtime (jms/serializer and jms-serializer-uri-handler both list it under
require-dev), so this removes it, and its psr/cache dependency, from
consumers' installs rather than leaving it behind transitively.

Released as a minor rather than a patch because of one downstream edge
case: getSerializerBuilder() is public API, and anyone who takes that
builder and serializes their own docblock-annotated classes will silently
lose that metadata rather than get an error. Such consumers should add
doctrine/annotations to their own composer.json.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013DMMmSMemViyZXtmDwQgvk
@deviantintegral
deviantintegral merged commit 4cc1613 into main Aug 11, 2026
19 of 20 checks passed
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