Inversion of Control: Implicit bindings
Stubbles does not force you to use interfaces in your type hints. If you are already using concrete classes, there is no need to bind them, as Stubbles will implicitly bind the concrete class to itself:
<?php class Window {} class BMW implements Car { protected $driver; protected $engine; protected $tire; protected $window; // same constructor and methods as in previous examples /** * @Inject */ public function setWindow(Window $win) { $this->window = $win; } } ?>
When creating an instance of BMW, it will automatically have a reference to an instance of Window although no special binding has been added.
Please note that implicit bindings turn into explicit bindings once the net::stubbles::ioc::stubInjector::hasBinding() or net::stubbles::ioc::stubInjector::getInstance() methods are called.
