Deanonymize Class

no-email (Damien Seguy), Damien Seguy
Sat, 21 Sep 2024 00:00:00 +0000

Anonymize class are classes without a name. That way, it provides directly an object, but doesn't litter the namespace with an extra class name.
Later, if the code needs a second object of the same 'class', it has to go through the same code.
Or, it is possible to get access to the 'hidden' definition of the class within PHP, by simply creating a class alias to this class. Then, it can be used anywhere else.
The sane alternative might be to simply give a name to the class, or make a direct clone of the object.
And as usual, if that class is not under the code's own control (say, external lib), it might be useful though hackish.