Abstract Constants

no-email (WebSmithery), WebSmithery
Sun, 19 Nov 2023 00:00:00 +0000

There's a pretty common pattern to declare "abstract class constants" in PHP.

PHP lazy loading will prevent the error "Fatal error: Uncaught Error: Cannot declare self-referencing constant self::NAME" if the constant is overloaded.

This makes an effective 'abstract constant', that must be defined to be usable.