Problem/Motivation
PHP now shipping #[Deprecated] native attribute - see RFC
Example
#[\Deprecated("use test() instead", since: "11.0")]
function test4() {
}
Steps to reproduce
# php -v
PHP 8.4.0RC1 (cli) (built: Sep 25 2024 10:17:43) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.0RC1, Copyright (c) Zend Technologies
with Zend OPcache v8.4.0RC1, Copyright (c), by Zend Technologies
# php --rc Deprecated
Class [ <internal:Core> final class Deprecated ] {
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [2] {
Property [ public protected(set) readonly ?string $message ]
Property [ public protected(set) readonly ?string $since ]
}
- Methods [1] {
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [2] {
Parameter #0 [ <optional> ?string $message = null ]
Parameter #1 [ <optional> ?string $since = null ]
}
}
}
}
Proposed resolution
Discuss it's usage and start use it (or SF polyfill v1.30.0) instead of doc-blocks
Polyfill added to core in #3523284: Update remaining Composer dependencies for 11.2.0
Comments
Comment #2
andypostsymfony/polyfill > 1.30.0is required for PHP 8.4 and the attribute https://github.com/symfony/polyfill/commit/1bd9f75235a0324e599aef3df6deb...Comment #3
mstrelan commentedThere is also #3458945: Make use of new functions from PHP 8.4 to add the same polyfill
Comment #4
andypostLooks in PHP 8.5 this attribute can be applied to constants if RFC pass https://wiki.php.net/rfc/attributes-on-constants
Comment #5
andypost