8000 [RFC][DependencyInjection] Deprecate the “@required” annotation · Issue #48909 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[RFC][DependencyInjection] Deprecate the “@required” annotation #48909
Closed
@alexislefebvre

Description

@alexislefebvre

Description

Symfony (including 6.2) supports the @required annotation, see for example with Symfony 5.4: https://symfony.com/doc/5.4/service_container/autowiring.html

Tests have to cover a wide range of different cases:

/** @inheritdoc*/ 7119 // <- brackets are missing on purpose

The proposal is to deprecate the @required annotation and suggest to replace it with Symfony\Contracts\Service\Attribute\Required.

This would simplify the codebase of Symfony at the next major release and encourage users to migrate from annotations to attributes.

See also:

Example

- /**
-  @required
- /
+ #[\Symfony\Contracts\Service\Attribute\Required]

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependencyInjectionRFCRFC = 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

      0