Uh oh!
There was an error while loading. Please reload this page.
RFC: Add #[\Deprecated] Attribute - #11293
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
andypost
commented
Jan 9, 2024
Please update RFC with link to this PR |
@beberlei, is there any chance to include a It can be used by PhpStorm, @rectorphp, and other tools in the ecosystem to simplify migration for end users. |
beberlei
commented
Apr 13, 2024
@pronskiy I can add it as a secondary vote, if i ever get around to finish the RFC for it. But it would be an essentially "useless" property from the engine POV that would be only useful for IDEs, and then without a standard, prone to conflicts. |
pronskiy
commented
Apr 13, 2024
@beberlei, how about adding a generic parameter? And letting tools to decide on the standard/convention, should there be one. #[Attribute(Attribute::TARGET_METHOD|Attribute::TARGET_FUNCTION)]
finalclass Deprecated
{
publicfunction__construct(?string$message = null, ...$extra) {}
}
#[Deprecated('Message', replacement: 'bar')]
foo(); |
Well, giving it another thought, tools could just have their own attribute #[
Deprecated('Message'),
Replacement('bar'),
]
foo(); |
bwoebi
commented
Apr 13, 2024
@beberlei Is there a specific reason #[Deprecated] is only targeting functions? Why not classes, so that any reference of the class, be it instantiation, or static access, emits the deprecation? |
@bwoebi no, i didnt get to this part yet due to my lack of engine skills :) |
Sysix
commented
Apr 13, 2024
Hello, As a small lib maintainer I like this idea. At the moment I use PHPDoc + |
0721ddc to
8911162CompareTimWolla
commented
Apr 15, 2024
TimWolla
commented
Apr 15, 2024
@bwoebi Constants do not (yet) support attributes. |
4613757 to
7109deaCompare7dcafb2 to
ce49812Compare#[\Deprecated] attribute#[\Deprecated] AttributeUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TimWolla
commented
Apr 29, 2024
Unfortunately, I'm unable to reproduce the ARM build failures. The tests within a Debian Docker container on a aarch64 VM appear to succeed: |
beberlei
commented
Apr 30, 2024
On my ARM Mac these also pass with |
iluuu1994
commented
Apr 30, 2024
@TimWolla This is likely related to the |
TimWolla
commented
Apr 30, 2024
Thanks, this reproduces the issue for me on x64 Linux: JIT is required. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TimWolla
commented
Jul 2, 2024
Now merged, thank you all for the review and assistance. The follow-up PR to apply the Attribute is here: #14750 |
RFC: https://wiki.php.net/rfc/deprecated_attribute
I made a mistake rebasing the previous PR #6521 and had to create this new one. Additional work is necessary to adapt this to new APIs and to move over the discussion and suggestions.
ToDo: