guilhermebla...@gmail.com wrote on 01/12/2014 15:27:
(1) Function/Namespaced function autoloading (2) State encapsulation (3) Function scoping
I would add (4) static polymorphism, which Late Static Binding explicitly supports.
But PHP is not one of these dogmatic “everything must be a class” languages: it has true global functions which can be namespaced.
By the same token, PHP is not one of those dogmatic languages which says that every class must have at least one instance. There may be advantages to giving your Factory class a constructor, but there is nothing in the language itself to stop you making it entirely out of static methods, and even sub-classing it from an abstract base using LSB.
The only thing missing is a standardised, enforced, annotation on the class to declare that you are using this ability and instances will never be created.
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php