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
Add PHP8 attributes for our existing service annotations #3619
Conversation
Can you give an example of how to use the new feature? |
Using named arguments you can skip the optional arguments 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing something but the constructor arguments do not match the annotations in the ServiceAnnotation
namespace, do they? E. g.
// AsContentElement
string $type = null,
string $category,
string $template = null,
string $method = null,
string $renderer = null,
array ...$attributes
// ContentElement
@Attributes({
@Attribute("value", type = "string"),
@Attribute("category", required = true, type = "string"),
@Attribute("template", type = "string"),
@Attribute("renderer", type = "string"),
@Attribute("attributes", type = "array"),
})
Is this correct?
Edit: As discussed with @aschempp, this is correct. The value
attribute corresponds to the $type
property and the $method
property is used to assign the attribute to a method, because
Unfortunately, Symfonys service attributes are not supported on methods, but the same can be done through the method argument.
Replaces terminal42/service-annotation-bundle#6
The new naming follows the Symfony convention