diff --git a/src/DI/Extensions/DIExtension.php b/src/DI/Extensions/DIExtension.php index 3171e9d88..9f0e2ab5d 100644 --- a/src/DI/Extensions/DIExtension.php +++ b/src/DI/Extensions/DIExtension.php @@ -36,7 +36,7 @@ public function __construct(bool $debugMode = false) $this->time = microtime(true); $this->config = new class { - /** @var bool */ + /** @var ?bool */ public $debugger; /** @var string[] */ @@ -58,7 +58,6 @@ public function __construct(bool $debugMode = false) /** @var string[]|bool|null */ public $types = true; }; - $this->config->debugger = interface_exists(\Tracy\IBarPanel::class); } @@ -86,7 +85,10 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class) $this->restrictTags($class); $this->restrictTypes($class); - if ($this->debugMode && $this->config->debugger) { + if ( + $this->debugMode && + ($this->config->debugger ?? $this->getContainerBuilder()->getByType(\Tracy\Bar::class)) + ) { $this->enableTracyIntegration(); }