This is a flat out lie.
This:
class Foo {
}
class Bar {
public function __construct(Foo $foo) {
$this->foo = $foo;
}
}
new Bar(new Foo);
is fewer lines of code, less complex and fewer method calls executed than
class Foo {
private static $instance;
public static function getInstance() {
if (empty(self::$instance)) {
self::$instance = new Foo;
}
return self::$instance;
}
}
class Bar {
public function __construct() {
$this->foo = Foo::getInstance();
}
}
new Bar();