Circular dependency - Injecting objects that are directly depended on each other
问题 I have used Dice PHP DI container for quite a while and it seems the best in terms of simplicity of injecting dependencies. From Dice Documentation: class A { public $b; public function __construct(B $b) { $this->b = $b; } } class B { } $dice = new \Dice\Dice; $a = $dice->create('A'); var_dump($a->b); //B object However, when you have to use objects that are directly dependent on each other, the finall result is server error, because of the infinite loop . Example: class A { public $b; public