Skip to content

Reconsider NamedArgumentConstructorAnnotation #379

@derrabus

Description

@derrabus

I would like to use the named constructor arguments feature in Symfony for some of the annotations there. We already have altered the constructors of most annotation classes in order to enable them to be used as attributes with named arguments as well. By leveraging this new way of constructing annotation classes, I expect to simplify those constructors again.

However, in order to do so, I have to add this marker interface NamedArgumentConstructorAnnotation to my annotation class. That‘s kind of a first because so far, we can construct instances of our annotation classes, even if the doctrine/annotations library is not installed. This becomes even more important if one fine day we wanted to build an application that uses PHP Attributes instead of Doctrine annotations everywhere.

Because of that, I wonder if we could find an alternative way to flag a class for named argument construction. Maybe we could achieve this with a @NamedArgumentConstructor annotation that has the same effect as the marker interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions