On Wed, Jun 18, 2025, at 13:09, 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
Yes, but when would it check it during runtime? It doesn't say in the RFC. From what I can tell, it effectively disables the attribute, unless someone happens to enumerate and instantiate all the attributes (which is unlikely). — Rob