https://matthewdaly.co.uk/blog/2023/08/13/why-nearly-every-php-class-you-write-should-be-abstract-or-final/Published by at 13th August 2023 3:00 pm If your introduction to object-oriented PHP was anything like mine, inheritance was probably touted as one of the biggest advantages.

Instead you're better off creating an abstract ResourceController class, and having your concrete resource classes extend that.

The Slevomat coding standard for PHP Codesniffer has a https://github.com/slevomat/coding-standard/blob/master/doc/classes.md#slevomatcodingstandardclassesrequireabstractorfinal- that enforces that every class must be abstract or final.

Explicitly declaring all classes I can as either abstract or final has greatly improved the quality of my code.
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