State of PHP deprecations in 2026

At work we’ve recently had a couple of code review discussions on PHP’s traditional @deprecated documentation tag, versus the newer #[Deprecated] language-feature attribute.

For non-technical readers, this means the team care greatly about attention to detail and keeping up with modern standards. You may also make your excuses now, we’re going deep here…

Since it’s 2026 (again, I know I’ve mentioned it twice now, how did this happen?) let’s get straight to it, and paste in the results of five minutes with an AI chatbot:

Aspect @deprecated #[Deprecated]
Purpose Documents deprecation for IDEs, tools, and docs Marks elements as deprecated
Introduction All versions 8.4, enhanced in 8.5
Applies To Classes
Interfaces
Traits
Functions
Methods
Properties
Global constants
Class constants
Enum cases
Parameters
Classes
Interfaces
Traits (8.5)
Functions
Methods
Properties
Global constants (8.5)
Class constants
Enum cases
Parameters
Optional parameters Semantic version and description message and since strings
Runtime notice No Yes
Reflection support No Yes
PhpStorm support Warnings, strikethrough Warnings, partial strikethrough
VS Code support Intelephense diagnostics Intelephense diagnostics

Twenty-five minutes of editing later…

Lots to consider, isn’t there? It’s almost, but not quite, down to personal preference at this stage (assuming PHP 8.5).

But personal preference doth butter no parsnips when a team is working on a project together. Shared standards and automated tooling are a must.

The addition of traits in 8.5 built on decent foundations from 8.4. But… it’s not uncommon for us to deprecate a class or interface, and there’s not even an RFC for that.

So, clearly #[Deprecated] is the future, but it’s not quite ready yet. And if you need/want runtime notices or reflection support, I’d probably be considering a hybrid approach.

There’s also the issue of IDE support. I started writing this post, expecting that’d be the main problem. Our company standard is PhpStorm, which doesn’t fully strikethrough deprecated elements — kind of the main point, I know. But that’ll likely get fixed before the language implements #[Deprecated] completely.

@deprecated it is then.

—-

Are you a joyfully curious Laravel developer?
If you care about the details (and I assume you do, having just read all that about deprecation!) my company is hiring

 
11
Kudos
 
11
Kudos

Now read this

Is this thing on?

Since going sober, and rediscovering my spirituality, I’ve become more attuned to synchronicities and intuition. Of course, my mind has a 40-year habit of suppressing those, and it still offers up plenty of resistance. Great. What’s that... Continue →