Final classes, you either love them or hate them. Developers have been discussing composition over inheritance for years, and final classes are a perfect use case.

Before final classes, we would extend the Money class and use it as I need to.

class MoneyImplementation { private Money $money; public function __construct( int|string $amount, Currency $currency, ) { $this->money = new Money( amount: $amount, currency: $currency, ); }}

The next problem is how do we call class methods on the money class without extending the API we want to call.
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