diff --git a/src/DI/AnnotationsExtension.php b/src/DI/AnnotationsExtension.php index b79992c..f0ac5b9 100644 --- a/src/DI/AnnotationsExtension.php +++ b/src/DI/AnnotationsExtension.php @@ -20,25 +20,31 @@ use Nette\DI\Config\Helpers as ConfigHelpers; use Nette\PhpGenerator\ClassType as ClassTypeGenerator; use Nette\PhpGenerator\PhpLiteral; +use Nette\Schema\Expect; +use Nette\Schema\Schema; use Nette\Utils\Validators; class AnnotationsExtension extends \Nette\DI\CompilerExtension { - /** @var array */ - public $defaults = [ - 'ignore' => [ - 'persistent', - 'serializationVersion', - ], - 'cache' => 'default', - 'debug' => '%debugMode%', - ]; + public function getConfigSchema(): Schema + { + return Expect::structure([ + 'ignore' => Expect::arrayOf('string')->default([ + 'persistent', + 'serializationVersion', + ]), + 'cache' => Expect::string('default'), + 'debug' => Expect::bool(interface_exists('Tracy\IBarPanel')), + 'debugMode' => Expect::bool(interface_exists('Tracy\IBarPanel')), + ])->castTo('array'); + } public function loadConfiguration(): void { $builder = $this->getContainerBuilder(); - $config = $this->getConfig($this->defaults); + /** @var array $config */ + $config = $this->config; $reflectionReader = $builder->addDefinition($this->prefix('reflectionReader')) ->setType(AnnotationReader::class)