Hi Benjamin, I have updated the RFC for a #[Deprecated] attribute that wasn't completed > for PHP 8.0 due to time constraints and I am able to restart the discussion > now. > > https://wiki.php.net/rfc/deprecated_attribute > > The following updates have been made: > > - focus on only method and function deprecations for now, removed > class/property/constant deprecations. > - a section on explaining the runtime effects of deprecations in PHP, and a > note that this RFC is about completing deprecation support within the > existing model, while changes to deprecations in general are out of scope / > a disjunct concern for a different RFC. > > Sara proposed a much improved implementation over my initial patch, by > using the already existing ZEND_ACC_DEPRECATED constant on userland > functions. The resulting implementation is therefore much simpler and > really just extending existing function deprecation support from internal > to userland functions. You can find the PR here: > > https://github.com/php/php-src/pull/6521 >
Thanks for the RFC. It would be great to allow adding this attribute on classes. What about allowing it right now and not bind it to any runtime side-effect? That would allow static analyzers to do their job. Same for consts and properties by the way. Also, it would be very useful to add named parameters to the attribute, namely: "package" (the name of the package that declares the deprecation) and "version" (the version of that package that introduced the deprecation), next to the message. This is critical info when building reports of deprecations. Thanks for considering, Nicolas