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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners