8000 [DI] Rework config hierarchy: defaults > instanceof > service config by weaverryan · Pull Request #22294 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] Rework config hierarchy: defaults > instanceof > service config #22294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8698228
Reworking the instanceof feature to act more like a "default" than li…
weaverryan Apr 5, 2017
db96c89
Moving changes tracking from ChildDefinition to Definition and fixing…
weaverryan Apr 5, 2017
24a6a83
Adding a test for the config overriding order
weaverryan Apr 6, 2017
6202909
Fixing a bug where instanceof was not copied into the new Definition …
weaverryan Apr 6, 2017
28d7d8d
Adding a test for instanceof behavior with parent-child services
weaverryan Apr 6, 2017
de0f718
Adding more tests
weaverryan Apr 6, 2017
8fd3738
Updating calls logic to merge/override with instanceof
weaverryan Apr 6, 2017
5e39c5d
Using Definition instead of ChildDefinition for instanceofConditionals
weaverryan Apr 6, 2017
132201e
Fixing outdated type-hint
weaverryan Apr 6, 2017
d7c4836
Fixing method name after rebase
weaverryan Apr 6, 2017
a44d92b
Making instanceof method call matching case insensitive
weaverryan Apr 6, 2017
a2aea3b
Fixing an edge case with instanceof property overriding when value is…
weaverryan Apr 6, 2017
5f9ca7c
A few tweaks thanks to nicolas
weaverryan Apr 6, 2017
2021675
Fixing missing use
weaverryan Apr 6, 2017
a95de6c
Thanks fabbot!
weaverryan Apr 6, 2017
34ad21a
Updating more code for ChildDefinition -> Definition change
weaverryan Apr 6, 2017
371fec2
Fixing failing tests: some of the compiler passes caused false "chang…
weaverryan Apr 6, 2017
82fa3c0
Updating DI tags logic to merge, but not replace tags
weaverryan Apr 6, 2017
1f2ce11
thanks fabbot!
weaverryan Apr 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Thanks fabbot!
  • Loading branch information
weaverryan committed Apr 6, 2017
commit a95de6c539b85b32deb0d4bee04a79d27e8765e3 8000
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ private function mergeInstanceofDefinition(Definition $def, Definition $instance
}
// merge method calls
if ($instanceofCalls = $instanceofDefinition->getMethodCalls()) {
$currentCallMethods = array_map(function($call) {
$currentCallMethods = array_map(function ($call) {
return strtolower($call[0]);
}, $def->getMethodCalls());

$uniqueInstanceofCalls = array_filter($instanceofCalls, function($instanceofCall) use ($currentCallMethods) {
$uniqueInstanceofCalls = array_filter($instanceofCalls, function ($instanceofCall) use ($currentCallMethods) {
// don't add an instanceof call if it was overridden on the service
return !in_array(strtolower($instanceofCall[0]), $currentCallMethods);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testConfigurationOverridePriority()
->setAutowired(false)
->setConfigurator('instanceof_configurator')
->addTag('foo')
->addTag('baz')
->addTag('baz'),
));

$container->compile();
Expand All @@ -164,7 +164,7 @@ public function testConfigurationOverridePriority()
// foo tag on service (parent) overrides instanceof
'foo' => array(array('foo_tag_attr' => 'bar')),
'bar' => array(array()),
'baz' => array(array())
'baz' => array(array()),
),
$container->getDefinition('child')->getTags()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testProcess()
->setAutowired(true)
->setProperty('foo', 'bar')
->setProperty('otherProp', 'baz')
->setProperty('nullProp', 'will_be_overridden')
->setProperty('nullProp', 'will_be_overridden'),
));

$this->process($container);
Expand Down Expand Up @@ -173,7 +173,7 @@ public function testConfigurationOverridePriority()
parent::class => (new Definition())
// overrides autowired on _defaults
->setAutowired(false)
->setConfigurator('foo_configurator')
->setConfigurator('foo_configurator'),
));

$def
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public function testGetChangesWithChanges()
$def->setShared(true);
$def->setSynthetic(true);
// changes aren't tracked for these, class or arguments
$def->setInstanceofConditionals([]);
$def->setInstanceofConditionals(array());
$def->addTag('foo_tag');
$def->addMethodCall('methodCall');
$def->setProperty('fooprop', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Symfony\Component\Config\Resource\DirectoryResource;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
use Symfony\Component\ExpressionLanguage\Expression;
Expand Down
0