Source: sebastiandedeyne.com

Dreaming of nested properties in PHP
https://sebastiandedeyne.com/php-wishlist-nested-properties/ https://sebastiandedeyne.com/tags/php/ https://sebastiandedeyne.com/tags/php-wishlist/Next on my https://sebastiandedeyne.com/tags/php-wishlist are nested properties. I don’t have a good syntax proposal for this, and I’m not even sure it’s the best solution for my problem.

{ public function __construct( public string $index, public string $store, public string $update, public string $delete, ) { { public function __construct( public int $id, public string $name, public string $email, public ContactResourceEndpoints $endpoints, ) { public static function fromContact(Contact $contact): self

Nested properties are also “anonymous” as they don’t have a name, which restricts them to be reused.
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