On Fri, Apr 5, 2024, at 1:09 PM, Joel Wurtz wrote:
Hello everyone,
Like a lot of libraries, we offer the possibility to configure
behaviors with Attributes. However in some cases it's wrongly
configured by the user and this wrong configuration cannot be detected
on the attribute constructor but afterwards.In this case we may want to pinpoint which attribute (in which file and
at which line) cause this bad configuration. Since there was no method
to retrieve those information in the ReflectionAttribute I proposed a
PR ext/reflection: add getLine / getFileName / isUserDefined to reflection attribute by joelwurtz · Pull Request #13889 · php/php-src · GitHub to add those informations.I do believe this will allow better DX for end user when correctly used,
Regards,
Joël Wurtz
Do you have an example of how you expect this to be used? I'm having a hard time understanding how I'd leverage this. (I maintain an attribute enhancement library, Crell/AttributeUtils, so I've hit a lot of edge cases in attribute design.)
--Larry Garfield