Skip to content

Commit

Permalink
parameters added via addParameters() has higher priority (BC break) (#56
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dg authored Mar 26, 2019
1 parent 1e78977 commit e1075af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Bootstrap/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ public function loadContainer(): string
*/
public function generateContainer(DI\Compiler $compiler): void
{
$compiler->addConfig(['parameters' => $this->parameters]);
$compiler->setDynamicParameterNames(array_keys($this->dynamicParameters));

$loader = $this->createLoader();
$loader->setParameters($this->parameters);

Expand All @@ -264,6 +261,9 @@ public function generateContainer(DI\Compiler $compiler): void
}
}

$compiler->addConfig(['parameters' => $this->parameters]);
$compiler->setDynamicParameterNames(array_keys($this->dynamicParameters));

$builder = $compiler->getContainerBuilder();
$builder->addExcludedClasses($this->autowireExcludedClasses);

Expand Down
4 changes: 2 additions & 2 deletions tests/Bootstrap/Configurator.basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ $configurator->setTempDirectory(TEMP_DIR);
$configurator->addParameters([
'wwwDir' => 'overwritten', // overwrites default value
'foo2' => '%foo%', // uses parameter from config file
'foo3' => '%foo%', // will be overwritten by config file
'foo3' => '%foo%', // will overwrite config file
]);
$container = $configurator->addConfig('files/configurator.basic.neon')
->createContainer();

Assert::same('overwritten', $container->parameters['wwwDir']);
Assert::same('hello world', $container->parameters['foo']);
Assert::same('hello world', $container->parameters['foo2']);
Assert::same('overwritten', $container->parameters['foo3']);
Assert::same('hello world', $container->parameters['foo3']);
Assert::same('hello', $container->parameters['bar']);
Assert::same('hello world', constant('BAR'));
Assert::same('Europe/Prague', date_default_timezone_get());
Expand Down

0 comments on commit e1075af

Please sign in to comment.