Refactoring #8: What is dead may never run

PHPDocs can be liars in disguise

One more thing I don’t like about these redundant docs is that they often ‘lie’. Take this for example:

Laravel’s default stubs

Another piece of dead code is the Laravel framework’s default stubs. They’re there so we can easily input our dependencies. What do we do if we don’t have any? Nothing, we just leave it there, because we’re lazy.

Conditions that are always true

Dead code candidate #4 is tricky. Usually, it’s safe to remove the redundant check like in this simple case:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Geni Jaho

Geni Jaho

Full-stack web developer with a passion for software architecture and programming best practices.