Inconsistent Constructor Signatures

no-email (Damien Seguy), Damien Seguy
Tue, 04 Apr 2023 00:00:00 +0000

PHP enforces that methods have the same signature in a parent class and in a children class. It raises a Fatal Error if not.
Unless for constructors, where the signatures can be different.
This exception to the rule is for legacy purposes, as many source code have varying signatures in a class hierarchy.
Yet, modern OOP recommends to synchronize those signatures, so has to allow instantiation using the same set of arguments.