Source: 63edb91e46663800083d0ea0--sebastiandedeyne-com-e11d52.netlify.app

Named arguments
Look at this code, I have no idea what false, false, true conveys. $page->render(false, false, true); A pattern I often see in older code is an associative array as the single parameter. At least the intent is clear, but arrays lack IDE completion and type safety. $page->render([ 'footer' => false, 'header' => false, 'include_assets' => true, ]); After another round of refactoring, we might end up with a bunch of fluent methods on the object.

{ private bool $showFooter = true; private bool $showHeader = true; private bool $includeAssets = false; public function showFooter(bool $showFooter): self
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