You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 16, 2019. It is now read-only.
Frank Kleine edited this page Aug 3, 2014
·
4 revisions
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:
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 one of these methods is called: