Deprecating a method had been a docblock tag that only an IDE respected, and 8.4 makes it something the engine reports.
final class TaxRates
{
#[Deprecated(
message: 'use for() instead',
since: '4.2.0',
)]
public static function lookup(string $country): Rate
{
return app(self::class)->for($country);
}
}
// calling it now emits E_USER_DEPRECATED, with the
// message and the version in the notice.
It works on functions, methods, constants and enum cases, and not on classes or properties in this release. The value is that the deprecation reaches a log rather than only an editor — a call from a package or a template that no static analyser reads now shows up in the same deprecation channel as the engine’s own, which is where somebody is already looking.