Skip to content

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Nov 24, 2025

Q A
Type improvement
BC Break yes
Fixed issues -

Summary

  • Remove AnnotationDriver and its configuration
  • Remove @Annotation from attribute classes
  • Remove annotations from test documents, already replaced by native attributes

@GromNaN GromNaN added this to the 3.0.0 milestone Nov 24, 2025
@IonBazan IonBazan mentioned this pull request Nov 25, 2025
17 tasks
Copy link
Member

@IonBazan IonBazan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We should also update the docs/annotations-reference.md accordingly.
  • PHP attributes are still in Annotations namespace - this is something we won't be able to change easily and might be confusing to new users as docs and other places still use annotations/attributes interchangeably.

@mickverm
Copy link

  • We should also update the docs/annotations-reference.md accordingly.
  • PHP attributes are still in Annotations namespace - this is something we won't be able to change easily and might be confusing to new users as docs and other places still use annotations/attributes interchangeably.

What about using the Annotation namespace as an alias of the Attribute namespace, like Symfony did? And deprecating the annotation namespace later?

https://github.com/symfony/symfony/blob/a518bc2c1a6cf59b65169dadcbeb8f3b91e2c06c/src/Symfony/Component/Routing/Annotation/Route.php

@IonBazan
Copy link
Member

@mickverm this is possible, even without aliasing - using inheritance but we would need to keep a copy of all Attribute classes. That should target 2.16.x or 2.17.x then once we decide whether we should pursue that option for v3.
We also need a Rector set to automate the renaming.

@GromNaN
Copy link
Member Author

GromNaN commented Nov 25, 2025

We have to check if that's possible with attributes, because they are read without actually loading the classes.
I would do the same as the namespace migration of Twig: add aliases in the attributes namespace in 2.x and move the concrete classes to the Attribute namespace in 3.0, keeping aliases in the Annotations namespace as deprecated.

@GromNaN
Copy link
Member Author

GromNaN commented Nov 25, 2025

See #2933

@GromNaN GromNaN merged commit 3568ecf into doctrine:3.0.x Nov 25, 2025
12 checks passed
@GromNaN GromNaN deleted the 3-drop-annotations branch November 25, 2025 11:38
@GromNaN GromNaN changed the title Remove support for Doctrine Annotations [3.x] Remove support for Doctrine Annotations Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants