You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature symfony#49358 [Routing] Deprecate annotations in favor of attributes (derrabus)
This PR was merged into the 6.4 branch.
Discussion
----------
[Routing] Deprecate annotations in favor of attributes
| Q | A
| ------------- | ---
| Branch? | 6.3
| Bug fix? | no
| New feature? | yes
| Deprecations? | yes
| Tickets | Follows symfony#50888
| License | MIT
| Doc PR | TODO, see symfony/symfony-docs#18589
This PR deprecates the integration of Doctrine Annotations for the Routing component.
Attributes are the way to go now if we want to annotate controllers with routing information. Existing applications can be migrated easily using [Rector](https://getrector.com/blog/how-to-upgrade-annotations-to-attributes).
Thus I believe that keeping support for oldschool Doctrine Annotations is not necessary anymore.
If this PR is accepted, I would work on a follow-up that renames all `Annotation*Loader` classes because the names of those classes are probably misleading as soon as they support attributes only.
Commits
-------
6ce15f2 [Routing] Deprecate annotations in favor of attributes
Copy file name to clipboardExpand all lines: UPGRADE-6.4.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,8 @@ Routing
64
64
-------
65
65
66
66
* Add native return type to `AnnotationClassLoader::setResolver()`
67
+
* Deprecate Doctrine annotations support in favor of native attributes
68
+
* Change the constructor signature of `AnnotationClassLoader` to `__construct(?string $env = null)`, passing an annotation reader as first argument is deprecated
Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ CHANGELOG
6
6
7
7
* Add FQCN and FQCN::method aliases for routes loaded from attributes/annotations when applicable
8
8
* Add native return type to `AnnotationClassLoader::setResolver()`
9
+
* Deprecate Doctrine annotations support in favor of native attributes
10
+
* Change the constructor signature of `AnnotationClassLoader` to `__construct(?string $env = null)`, passing an annotation reader as first argument is deprecated
trigger_deprecation('symfony/routing', '6.4', 'Passing an instance of "%s" as first and the environment as second argument to "%s" is deprecated. Pass the environment as first argument instead.', Reader::class, __METHOD__);
trigger_deprecation('symfony/routing', '6.4', 'Class "%s" uses Doctrine Annotations to configure routes, which is deprecated. Use PHP attributes instead.', $class->getName());
0 commit comments