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
Attributes can reference either a single attribute class or multiple attribute classes.
While splitting the attribute up to its individual parts and potentially retrieving a list of attribute class names is not that hard to do, it still makes for duplicate code and could benefit from caching if this action is executed in multiple sniffs.
#[MyAttributeA(12, 34), MyAttributeB(5678)]
Describe the solution you'd like
I imagine a new PHPCSUtils\Utils\Attributes utility class could be added with one or more helper methods, the precise form these will take, is yet to be determined.
Additional context (optional)
The above could also benefit from the namespace resolution features which are already planned for PHPCSUtils.
Also note that the PassedParameters class can already handle parsing the parameters passed to an attribute class.
Is your feature request related to a problem?
PHP 8.0 introduced attributes.
Attributes can reference either a single attribute class or multiple attribute classes.
While splitting the attribute up to its individual parts and potentially retrieving a list of attribute class names is not that hard to do, it still makes for duplicate code and could benefit from caching if this action is executed in multiple sniffs.
Describe the solution you'd like
I imagine a new
PHPCSUtils\Utils\Attributes
utility class could be added with one or more helper methods, the precise form these will take, is yet to be determined.Additional context (optional)
The above could also benefit from the namespace resolution features which are already planned for PHPCSUtils.
Also note that the
PassedParameters
class can already handle parsing the parameters passed to an attribute class.This ticket is inspired by PHPCompatibility/PHPCompatibility#1480
The text was updated successfully, but these errors were encountered: