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
It would be great to be able to define the default property for annotation. At the moment, it always target the property named value. The ability to change this behaviour could lead to more explicit variables names and a better compatibility with PHP8 attributes.
We could support the attribute default_property in many ways:
Add it to the @Annotation annotation, like @Annotation(defaultProperty="name"). But as explained here Introduced annotation NamedArgumentConstructor #391 , this annotation is kind of special as it is detected through str_pos.
Add a new annotation @DefaultProperty, like @DefaultPropety("name")
Add this attribute with NamedArgumentConstructorAnnotation only.
Another path would be to force the DocParser to respect argument constructor arguments order if there is a mix of named / not named arguments.
It would be great to be able to define the default property for annotation. At the moment, it always target the property named
value. The ability to change this behaviour could lead to more explicit variables names and a better compatibility with PHP8 attributes.See the following example.
The supported syntax are:
but this one is not supported as it expects a
valueproperty.Note that this is already handled in the Doc Parser for annotation like
@Annotation\Attribute, as the default property in this case isname.We could support the attribute
default_propertyin many ways:@Annotationannotation, like@Annotation(defaultProperty="name"). But as explained here Introduced annotation NamedArgumentConstructor #391 , this annotation is kind of special as it is detected throughstr_pos.@DefaultProperty, like@DefaultPropety("name")NamedArgumentConstructorAnnotationonly.Another path would be to force the DocParser to respect argument constructor arguments order if there is a mix of named / not named arguments.