DEV Community


Discussion on: How to deprecate a type in php

aleksikauppila profile image
Aleksi Kauppila • Edited

It's not an implementation issue imo. This is from Semantic versioning homepage:

How should I handle deprecating functionality?

Deprecating existing functionality is a normal part of software development and is often required to make forward progress. When you deprecate part of your public API, you should do two things: (1) update your documentation to let users know about the change, (2) issue a new minor release with the deprecation in place. Before you completely remove the functionality in a new major release there should be at least one minor release that contains the deprecation so that users can smoothly transition to the new API.

Thread Thread
greg0ire profile image
Grégoire Paris Author

Maybe that was unclear (I wrote this in a rush), but this blog post is about how you can implement that part of SemVer (deprecating part of your public API) for php types. Not sure what "It" is referring to in "It's not an implementation issue IMO" or why you two attempt to teach me the basics of SemVer when I'm trying to show how to put it in practice for a specific part of a PHP API.

Thread Thread
aleksikauppila profile image
Aleksi Kauppila

Ah, with "it" i mean deprecating a type in php. As far as i'm concerned this is enough:


// LegacyFoo.php

 * @deprecated please use ShinyNewFoo instead!
interface LegacyFoo

But i also accept the fact that i may have missed some point in this article...

Thread Thread
greg0ire profile image
Grégoire Paris Author

This solution is enough in some situations. In others, you will need inheritance, and in some more complicated situations, you will have to resort to class aliases. That's what I failed to make perfectly clear in my article.