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

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