8000 Making all _defaults apply, but this breaks the tests for now · symfony/symfony@50ad8b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 50ad8b4

Browse files
committed
Making all _defaults apply, but this breaks the tests for now
1 parent 6140c90 commit 50ad8b4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ private function parseDefinition($id, $service, $file, array $defaults)
357357
$definition = new ChildDefinition($service['parent']);
358358
} else {
359359
$definition = new Definition();
360+
}
360361

362+
if (!$this->isLoadingInstanceof) {
361363
if (isset($defaults['public'])) {
362364
$definition->setPublic($defaults['public']);
363365
}
@@ -368,7 +370,15 @@ private function parseDefinition($id, $service, $file, array $defaults)
368370
$definition->setAutoconfigured($defaults['autoconfigure']);
369371
}
370372

371-
$definition->setChanges(array());
373+
// don't reset changes for children, otherwise their
374+
// parent values will always win, even if they're not
375+
// explicitly set. We should be able to remove this if
376+
// the ResolveDefinitionTemplatesPass is made smarter
377+
// to only override values from the parent *if* they
378+
// are explicitly set.
379+
if (!$definition instanceof ChildDefinition) {
380+
$definition->setChanges(array());
381+
}
372382
}
373383

374384
if (isset($service['class'])) {

0 commit comments

Comments
 (0)
0