According to the PHP manual, a class like this:
abstract class Example {}
cannot be instantiated. If I need a class without instance, e.g. for
There are patterns in OO that are common and well-recognized. Using abstract
in an unconventional way may cause confusion (sorry, my some examples are in Java instead of PHP):
abstract
modifier on class to prevent direct instantiation, but allow deriving from the classfinal
modifier on class, andfinal
modifier on class, andgetInstance()
) that returns the only instance or one of the limited number of instances