On 18 June 2025 13:09:26 CEST, kont...@beberlei.de wrote: > >Von meinem iPhone gesendet > >> Am 18.06.2025 um 11:26 schrieb Rob Landers <rob@bottled.codes>: >> >> >>> >>> On Wed, Jun 18, 2025, at 01:26, Daniel Scherzer wrote: >>> Hi internals, >>> >>> I'd like to start the discussion for a new RFC about adding a >>> `#[\DelayedTargetValidation]` attribute. >>> >>> * RFC: https://wiki.php.net/rfc/delayedtargetvalidation_attribute >>> * Implementation: https://github.com/php/php-src/pull/18817 >>> >>> --Daniel >> >> Interesting. I’d also argue for the inverse more than this, though. I’d like >> for my attributes to be validated during compilation instead of delayed to >> runtime -- which, it isn’t actually. Runtime validation ONLY happens when >> calling ->newInstance() on ReflectionAttribute, and never before then. So, >> only when an attribute is actually read during reflection is it validated. >> Further, if you never actually instantiate it ... it is never actually >> validated (i.e., just looking for the presence of an attribute, not the >> details). >> >> https://3v4l.org/UqQKi > > >As Daniel’s rfc mentions you need to differentiate between compiler and >userland attributes. > >The compiler attributes are validated at compile time not dueing newInstance. > >> >> — Rob
Just as an information: We are at the moment in the proces of setting up a registry for userland attributes at the PHP-FIG. For more information regarding that check out <https://github.com/php-fig/fig-standards/pull/1331> Cheers Andreas -- Andreas Heigl