Hi
On 11/30/24 18:00, Daniel Scherzer wrote:
Based on feedback to my last thread[1] that an RFC would be needed to allow
attributes on constants, I have just filed
https://wiki.php.net/rfc/attributes-on-constants and added it to the "Under
Discussion" section on the main RFC page.
Thank you for your RFC. As you might have guessed from my comments on
the PR, I quite like the proposal to round off attributes. Nevertheless
any new syntax has quite a bit of an impact on tooling around PHP (see
also (3) below), so I'm curious if you already have any use cases
besides the `#[\Deprecated]` attribute that could be mentioned in the
RFC text?
-----------
Other than that, I have the following remarks to the RFC itself:
1.
”New constant Attribute::TARGET_CONSTANT may conflict with subclasses
that define such a constant of their own.”
This is a non-issue, because the Attribute class is final.
2.
”Extensions that validate the usage of their attributes and use
Attribute::TARGET_ALL may need to be updated.”
This is not just extensions, but also userland code that did not
anticipate any new attribute targets.
3.
The “Backward Incompatible Changes” section should probably shortly
mention that this is new syntax and will need changes to IDEs, static
analysis tools and formatters. The second paragraph in
https://wiki.php.net/rfc/closures_in_const_expr#backward_incompatible_changes
might be a good example.
Best regards
Tim Düsterhus