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

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