Skip to content

Commit

Permalink
Merge pull request #23 from haltuf/nette-3.0
Browse files Browse the repository at this point in the history
Nette 3.0
  • Loading branch information
enumag authored Aug 22, 2019
2 parents 4bff2a5 + f3d16cd commit 105e30a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/DI/AnnotationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 105e30a

Please # to comment.