Skip to content

[RFC] Consistently use the word "attribute" in all symbols #51381

Closed
@derrabus

Description

@derrabus

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.

  • The serializer integration of FrameworkBundle exposes a configuration option enable_annotations. Rename to enable_attributes.
  • The validation integration of FrameworkBundle exposes a configuration option enable_annotations. Rename to enable_attributes.
  • The Routing and Serializer components organize their attribute classes in a namespace called Annotation. Rename that namespace to Attribute.
  • When loading routes from attributes, the loader type is annotation although attribute is already an alias for that. Make attribute the only possible type.
  • Serializer uses a class named AnnotationLoader to load metadata from attributes. Rename to AttributeLoader.
  • Validation uses a class named AnnotationLoader to load metadata from attributes. Rename to AttributeLoader.
  • Routing contains classes AnnotationClassLoader and AnnotationDirectoryLoader for loading routes from attributes. Rename to AttributeClassLoader and AttributeDirectoryLoader.

If you find more TODOs, please drop a comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions