-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Consistently use the word "attribute" in all symbols #51381
Comments
I'm fine with all items except the second one:
I think this can lead to costly migrations from 6 to 7. The benefit might not be worth the troubles. For validation, I'm also wondering if the move shouldn't do one more step and clean the way we create those objects. Right now, constructors are a bit strange. Maybe relying only on named args is possible? |
I don't know. In all of the codebases I've seen those attributes in action, they're imported like this: use Symfony\Component\Routing\Annotation\Route; This looks like a big search&replace to me. Your favorite IDE should be able to handle that. |
I've created #51393 for that. This might be a bit heavier to migrate, I'm afraid. |
@derrabus a search-and-replace only works if you don't need to support multiple versions of Symfony in your code base. |
We should also consider if deprecating and providing the alternative in the same version isn't too harsh. We know this breaks migration paths for third party bundles. We could instead provide the alternative in 6.4, and deprecate in 7.1. We need to decide if this concern apply to the listed cases. WDYT? |
I'm not sure if there are many third party bundles that use attributes, given it needs to be enabled by the user for both validation and routing? |
…rrences (alexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Validator] Deprecate annotation occurrences | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Part of #51381 | License | MIT | Doc PR | - * Deprecate `framework.validation.enable_annotations` in favor of `framework.validation.enable_attributes` * Deprecate `framework.serializer.enable_annotations` in favor of use `framework.serializer.enable_attributes` * Deprecate `ValidatorBuilder::enableAnnotationMapping()` in favor of `ValidatorBuilder::enableAttributeMapping()` * Deprecate `ValidatorBuilder::disableAnnotationMapping()` in favor of `ValidatorBuilder::disableAttributeMapping()` * Deprecate `AnnotationLoader` in favor of `AttributeLoader` Commits ------- 2e1e805 [FrameworkBundle][Validator] Deprecate annotation occurrences
…rrences (alexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Validator] Deprecate annotation occurrences | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Part of symfony/symfony#51381 | License | MIT | Doc PR | - * Deprecate `framework.validation.enable_annotations` in favor of `framework.validation.enable_attributes` * Deprecate `framework.serializer.enable_annotations` in favor of use `framework.serializer.enable_attributes` * Deprecate `ValidatorBuilder::enableAnnotationMapping()` in favor of `ValidatorBuilder::enableAttributeMapping()` * Deprecate `ValidatorBuilder::disableAnnotationMapping()` in favor of `ValidatorBuilder::disableAttributeMapping()` * Deprecate `AnnotationLoader` in favor of `AttributeLoader` Commits ------- 2e1e805f89 [FrameworkBundle][Validator] Deprecate annotation occurrences
…rrences (alexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Validator] Deprecate annotation occurrences | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Part of symfony/symfony#51381 | License | MIT | Doc PR | - * Deprecate `framework.validation.enable_annotations` in favor of `framework.validation.enable_attributes` * Deprecate `framework.serializer.enable_annotations` in favor of use `framework.serializer.enable_attributes` * Deprecate `ValidatorBuilder::enableAnnotationMapping()` in favor of `ValidatorBuilder::enableAttributeMapping()` * Deprecate `ValidatorBuilder::disableAnnotationMapping()` in favor of `ValidatorBuilder::disableAttributeMapping()` * Deprecate `AnnotationLoader` in favor of `AttributeLoader` Commits ------- 2e1e805f89 [FrameworkBundle][Validator] Deprecate annotation occurrences
|
…andre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Routing] Deprecate annotations | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | Part of #51381 | License | MIT | Doc PR | - * Deprecate the `routing.loader.annotation` service, use the `routing.loader.attribute` service instead * Deprecate the `routing.loader.annotation.directory` service, use the `routing.loader.attribute.directory` service instead * Deprecate the `routing.loader.annotation.file` service, use the `routing.loader.attribute.file` service instead * Deprecate `AnnotationClassLoader`, use `AttributeClassLoader` instead * Deprecate `AnnotationDirectoryLoader`, use `AttributeDirectoryLoader` instead * Deprecate `AnnotationFileLoader`, use `AttributeFileLoader` instead * Deprecate `AnnotatedRouteControllerLoader`, use `AttributeRouteControllerLoader` Commits ------- 708b1b6 [FrameworkBundle][Routing] Deprecate annotations
…lexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Serializer] Deprecate annotations | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Part of #51381 Commits ------- a658692 [FrameworkBundle][Serializer] Deprecate annotations
…lexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Serializer] Deprecate annotations | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Part of symfony/symfony#51381 Commits ------- a6586923e7 [FrameworkBundle][Serializer] Deprecate annotations
…lexandre-daubois) This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Serializer] Deprecate annotations | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Part of symfony/symfony#51381 Commits ------- a6586923e7 [FrameworkBundle][Serializer] Deprecate annotations
I've checked three more boxes. The |
I'd say yes! |
Let's close this issue then? I don't mind the namespace - or I would mind the migration cost :) |
I agree |
I think this is a good option: "We could instead provide the alternative in 6.4, and deprecate in 7.1." Let's alias in 6.4/7.0 and start the deprecation path in 7.x. By the time 8.0 is released, libraries only need to support 6.4 and 7.x, meaning they can switch to the Sure, the "Annotation" part doesn't mind an experienced PHP and Symfony developer that knows the time before PHP attributes. But it can already confuse people that are learning Symfony right now, and this will increase in significance the more we are away of the doctrine/annotations era. |
Here we go: #52294 |
Thanks you all for the help! |
…s (wouterj) This PR was merged into the 6.4 branch. Discussion ---------- [Routing][Serializer] Add annotation -> attribute aliases | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #51381 | License | MIT Commits ------- cce20a4 Add annotation -> attribute aliases
Description
Doctrine Annotations have served us well, but PHP attributes are the future.
Our strategy for Symfony 6 was to support Doctrine Annotations and PHP attributes as two ways of annotating pieces of configuration to code. In Symfony 7, attributes will be the only supported way. However, we still use the word "annotation" in the codebase in an abstract sense (PHP attributes are a form of annotation). This might be confusing, so we might consider using the work "attribute" everywhere consistently.
I've opened this issue to collect all occurrences of the term and to discuss the possible impact on downstream projects.
serializer
integration of FrameworkBundle exposes a configuration optionenable_annotations
. Rename toenable_attributes
.validation
integration of FrameworkBundle exposes a configuration optionenable_annotations
. Rename toenable_attributes
.Annotation
. Rename that namespace toAttribute
.annotation
althoughattribute
is already an alias for that. Makeattribute
the only possible type.AnnotationLoader
to load metadata from attributes. Rename toAttributeLoader
.AnnotationLoader
to load metadata from attributes. Rename toAttributeLoader
.AnnotationClassLoader
andAnnotationDirectoryLoader
for loading routes from attributes. Rename toAttributeClassLoader
andAttributeDirectoryLoader
.If you find more TODOs, please drop a comment.
The text was updated successfully, but these errors were encountered: