Unfinished Class Doesn't Compile

no-email (Jan Nedbal), Jan Nedbal
Sat, 17 Feb 2024 00:00:00 +0000

PHP is not able to use a class before it is defined. Yet, when the second class is simple enough to be entirely defined, it would. When the class is not completely defined, aka it has the extends, implements, or use (for trait) keywords, PHP postpone the finalization of the class to execution phase, and consider it as non-defined.