It's important to take a good look at your code and clean up when you're done with it. Once in a while, we tend to forget this little detail and just move on, leaving behind trails of unreachable statements.

There is this automated tool called https://getrector.org/ that is fantastic at finding dead code like this and removing it, or letting you know of its existence. Rector also unearths other dead code that is not completely obvious at first sight.

$user->canPost()) { ... return false; } ... $this->updateUserPermissions(); // You might want to keep this check // even if you've checked at the top if ($user->canPost()) { return true; }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners