feature #26921 [DI][FrameworkBundle] Hide service ids that start with a dot (nicolas-grekas)
This PR was merged into the 4.1-dev branch.
Discussion
----------
[DI][FrameworkBundle] Hide service ids that start with a dot
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #26630
| License | MIT
| Doc PR | -
Now that services are private by default, `debug:container` should display them by default.
In fact, the public/private concept should not trigger a difference in visibility for this command.
Instead, I propose to handle service ids that start with a dot as hidden services.
PR should be ready.
(For reference, I tried using a tag instead in #26891, but that doesn't work in practice when working on the implementation.)
Commits
-------
cea051ee5e
[DI][FrameworkBundle] Hide service ids that start with a dot
This commit is contained in:
commit
833909bd68
@ -48,8 +48,9 @@ class ContainerDebugCommand extends Command
|
||||
$this
|
||||
->setDefinition(array(
|
||||
new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'),
|
||||
new InputOption('show-private', null, InputOption::VALUE_NONE, 'Used to show public *and* private services'),
|
||||
new InputOption('show-private', null, InputOption::VALUE_NONE, 'Used to show public *and* private services (deprecated)'),
|
||||
new InputOption('show-arguments', null, InputOption::VALUE_NONE, 'Used to show arguments in services'),
|
||||
new InputOption('show-hidden', null, InputOption::VALUE_NONE, 'Used to show hidden (internal) services'),
|
||||
new InputOption('tag', null, InputOption::VALUE_REQUIRED, 'Shows all services with a specific tag'),
|
||||
new InputOption('tags', null, InputOption::VALUE_NONE, 'Displays tagged services for an application'),
|
||||
new InputOption('parameter', null, InputOption::VALUE_REQUIRED, 'Displays a specific parameter for an application'),
|
||||
@ -72,11 +73,6 @@ To see available types that can be used for autowiring, use the <info>--types</i
|
||||
|
||||
<info>php %command.full_name% --types</info>
|
||||
|
||||
By default, private services are hidden. You can display all services by
|
||||
using the <info>--show-private</info> flag:
|
||||
|
||||
<info>php %command.full_name% --show-private</info>
|
||||
|
||||
Use the --tags option to display tagged <comment>public</comment> services grouped by tag:
|
||||
|
||||
<info>php %command.full_name% --tags</info>
|
||||
@ -93,6 +89,11 @@ Display a specific parameter by specifying its name with the <info>--parameter</
|
||||
|
||||
<info>php %command.full_name% --parameter=kernel.debug</info>
|
||||
|
||||
By default, internal services are hidden. You can display them
|
||||
using the <info>--show-hidden</info> flag:
|
||||
|
||||
<info>php %command.full_name% --show-hidden</info>
|
||||
|
||||
EOF
|
||||
)
|
||||
;
|
||||
@ -103,6 +104,10 @@ EOF
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if ($input->getOption('show-private')) {
|
||||
@trigger_error('The "--show-private" option no longer has any effect and is deprecated since Symfony 4.1.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$errorIo = $io->getErrorStyle();
|
||||
|
||||
@ -110,7 +115,7 @@ EOF
|
||||
$object = $this->getContainerBuilder();
|
||||
|
||||
if ($input->getOption('types')) {
|
||||
$options = array('show_private' => true);
|
||||
$options = array();
|
||||
$options['filter'] = array($this, 'filterToServiceTypes');
|
||||
} elseif ($input->getOption('parameters')) {
|
||||
$parameters = array();
|
||||
@ -122,19 +127,20 @@ EOF
|
||||
} elseif ($parameter = $input->getOption('parameter')) {
|
||||
$options = array('parameter' => $parameter);
|
||||
} elseif ($input->getOption('tags')) {
|
||||
$options = array('group_by' => 'tags', 'show_private' => $input->getOption('show-private'));
|
||||
$options = array('group_by' => 'tags');
|
||||
} elseif ($tag = $input->getOption('tag')) {
|
||||
$options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
|
||||
$options = array('tag' => $tag);
|
||||
} elseif ($name = $input->getArgument('name')) {
|
||||
$name = $this->findProperServiceName($input, $errorIo, $object, $name);
|
||||
$options = array('id' => $name);
|
||||
} else {
|
||||
$options = array('show_private' => $input->getOption('show-private'));
|
||||
$options = array();
|
||||
}
|
||||
|
||||
$helper = new DescriptorHelper();
|
||||
$options['format'] = $input->getOption('format');
|
||||
$options['show_arguments'] = $input->getOption('show-arguments');
|
||||
$options['show_hidden'] = $input->getOption('show-hidden');
|
||||
$options['raw_text'] = $input->getOption('raw');
|
||||
$options['output'] = $io;
|
||||
$helper->describe($io, $object, $options);
|
||||
|
@ -15,6 +15,7 @@ use Symfony\Component\Console\Descriptor\DescriptorInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@ -230,17 +231,21 @@ abstract class Descriptor implements DescriptorInterface
|
||||
return $builder->getAlias($serviceId);
|
||||
}
|
||||
|
||||
if ('service_container' === $serviceId) {
|
||||
return (new Definition(ContainerInterface::class))->setPublic(true)->setSynthetic(true);
|
||||
}
|
||||
|
||||
// the service has been injected in some special way, just return the service
|
||||
return $builder->get($serviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showHidden
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function findDefinitionsByTag(ContainerBuilder $builder, $showPrivate)
|
||||
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden)
|
||||
{
|
||||
$definitions = array();
|
||||
$tags = $builder->findTags();
|
||||
@ -250,7 +255,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) {
|
||||
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
||||
|
||||
if (!$definition instanceof Definition || !$showPrivate && !$definition->isPublic()) {
|
||||
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
$data = array();
|
||||
|
||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
||||
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||
$data[$tag] = array();
|
||||
foreach ($definitions as $definition) {
|
||||
$data[$tag][] = $this->getContainerDefinitionData($definition, true);
|
||||
@ -100,7 +100,7 @@ class JsonDescriptor extends Descriptor
|
||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];
|
||||
$showArguments = isset($options['show_arguments']) && $options['show_arguments'];
|
||||
$data = array('definitions' => array(), 'aliases' => array(), 'services' => array());
|
||||
@ -112,14 +112,14 @@ class JsonDescriptor extends Descriptor
|
||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
||||
|
||||
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($service instanceof Alias) {
|
||||
if ($showPrivate || ($service->isPublic() && !$service->isPrivate())) {
|
||||
$data['aliases'][$serviceId] = $this->getContainerAliasData($service);
|
||||
}
|
||||
$data['aliases'][$serviceId] = $this->getContainerAliasData($service);
|
||||
} elseif ($service instanceof Definition) {
|
||||
if (($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
|
||||
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments);
|
||||
}
|
||||
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments);
|
||||
} else {
|
||||
$data['services'][$serviceId] = get_class($service);
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ class MarkdownDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
$this->write("Container tags\n==============");
|
||||
|
||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
||||
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||
$this->write("\n\n".$tag."\n".str_repeat('-', strlen($tag)));
|
||||
foreach ($definitions as $serviceId => $definition) {
|
||||
$this->write("\n\n");
|
||||
@ -119,9 +119,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
|
||||
$title = $showPrivate ? 'Public and private services' : 'Public services';
|
||||
$title = $showHidden ? 'Hidden services' : 'Services';
|
||||
if (isset($options['tag'])) {
|
||||
$title .= ' with tag `'.$options['tag'].'`';
|
||||
}
|
||||
@ -138,14 +138,14 @@ class MarkdownDescriptor extends Descriptor
|
||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
||||
|
||||
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($service instanceof Alias) {
|
||||
if ($showPrivate || ($service->isPublic() && !$service->isPrivate())) {
|
||||
$services['aliases'][$serviceId] = $service;
|
||||
}
|
||||
$services['aliases'][$serviceId] = $service;
|
||||
} elseif ($service instanceof Definition) {
|
||||
if (($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
|
||||
$services['definitions'][$serviceId] = $service;
|
||||
}
|
||||
$services['definitions'][$serviceId] = $service;
|
||||
} else {
|
||||
$services['services'][$serviceId] = $service;
|
||||
}
|
||||
|
@ -122,15 +122,15 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
|
||||
if ($showPrivate) {
|
||||
$options['output']->title('Symfony Container Public and Private Tags');
|
||||
if ($showHidden) {
|
||||
$options['output']->title('Symfony Container Hidden Tags');
|
||||
} else {
|
||||
$options['output']->title('Symfony Container Public Tags');
|
||||
$options['output']->title('Symfony Container Tags');
|
||||
}
|
||||
|
||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
||||
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||
$options['output']->section(sprintf('"%s" tag', $tag));
|
||||
$options['output']->listing(array_keys($definitions));
|
||||
}
|
||||
@ -165,13 +165,13 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$showPrivate = isset($options['show_private']) && $options['show_private'];
|
||||
$showHidden = isset($options['show_hidden']) && $options['show_hidden'];
|
||||
$showTag = isset($options['tag']) ? $options['tag'] : null;
|
||||
|
||||
if ($showPrivate) {
|
||||
$title = 'Symfony Container Public and Private Services';
|
||||
if ($showHidden) {
|
||||
$title = 'Symfony Container Hidden Services';
|
||||
} else {
|
||||
$title = 'Symfony Container Public Services';
|
||||
$title = 'Symfony Container Services';
|
||||
}
|
||||
|
||||
if ($showTag) {
|
||||
@ -189,12 +189,14 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
foreach ($serviceIds as $key => $serviceId) {
|
||||
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
||||
|
||||
// filter out hidden services unless shown explicitly
|
||||
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||
unset($serviceIds[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($definition instanceof Definition) {
|
||||
// filter out private services unless shown explicitly
|
||||
if (!$showPrivate && (!$definition->isPublic() || $definition->isPrivate())) {
|
||||
unset($serviceIds[$key]);
|
||||
continue;
|
||||
}
|
||||
if ($showTag) {
|
||||
$tags = $definition->getTag($showTag);
|
||||
foreach ($tags as $tag) {
|
||||
@ -208,11 +210,6 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($definition instanceof Alias) {
|
||||
if (!$showPrivate && (!$definition->isPublic() || $definition->isPrivate())) {
|
||||
unset($serviceIds[$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class XmlDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_private']) && $options['show_private']));
|
||||
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden']));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +78,7 @@ class XmlDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
||||
{
|
||||
$this->writeDocument($this->getContainerServicesDocument($builder, isset($options['tag']) ? $options['tag'] : null, isset($options['show_private']) && $options['show_private'], isset($options['show_arguments']) && $options['show_arguments'], isset($options['filter']) ? $options['filter'] : null));
|
||||
$this->writeDocument($this->getContainerServicesDocument($builder, isset($options['tag']) ? $options['tag'] : null, isset($options['show_hidden']) && $options['show_hidden'], isset($options['show_arguments']) && $options['show_arguments'], isset($options['filter']) ? $options['filter'] : null));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -231,12 +231,12 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
private function getContainerTagsDocument(ContainerBuilder $builder, bool $showPrivate = false): \DOMDocument
|
||||
private function getContainerTagsDocument(ContainerBuilder $builder, bool $showHidden = false): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
||||
|
||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
||||
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||
$containerXML->appendChild($tagXML = $dom->createElement('tag'));
|
||||
$tagXML->setAttribute('name', $tag);
|
||||
|
||||
@ -269,7 +269,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showPrivate = false, bool $showArguments = false, callable $filter = null): \DOMDocument
|
||||
private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showHidden = false, bool $showArguments = false, callable $filter = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
||||
@ -283,7 +283,7 @@ class XmlDescriptor extends Descriptor
|
||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
||||
|
||||
if (($service instanceof Definition || $service instanceof Alias) && !($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
|
||||
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class CachePoolPass implements CompilerPassInterface
|
||||
if ($usedEnvs || preg_match('#^[a-z]++://#', $name)) {
|
||||
$dsn = $name;
|
||||
|
||||
if (!$container->hasDefinition($name = 'cache_connection.'.ContainerBuilder::hash($dsn))) {
|
||||
if (!$container->hasDefinition($name = '.cache_connection.'.ContainerBuilder::hash($dsn))) {
|
||||
$definition = new Definition(AbstractAdapter::class);
|
||||
$definition->setPublic(false);
|
||||
$definition->setFactory(array(AbstractAdapter::class, 'createConnection'));
|
||||
|
@ -119,7 +119,7 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
{
|
||||
$builder = current(ObjectsProvider::getContainerBuilders());
|
||||
$builder->setDefinition('service_1', $builder->getDefinition('definition_1'));
|
||||
$builder->setDefinition('service_2', $builder->getDefinition('definition_2'));
|
||||
$builder->setDefinition('.service_2', $builder->getDefinition('.definition_2'));
|
||||
|
||||
$aliases = ObjectsProvider::getContainerAliases();
|
||||
$aliasesWithDefinitions = array();
|
||||
@ -130,8 +130,10 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
$i = 0;
|
||||
$data = $this->getDescriptionTestData($aliasesWithDefinitions);
|
||||
foreach ($aliases as $name => $alias) {
|
||||
$file = array_pop($data[$i]);
|
||||
$data[$i][] = $builder;
|
||||
$data[$i][] = array('id' => $name);
|
||||
$data[$i][] = $file;
|
||||
++$i;
|
||||
}
|
||||
|
||||
@ -148,8 +150,12 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
{
|
||||
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
|
||||
|
||||
$file = array_pop($data[0]);
|
||||
$data[0][] = array('parameter' => 'database_name');
|
||||
$data[0][] = $file;
|
||||
$file = array_pop($data[1]);
|
||||
$data[1][] = array('parameter' => 'twig.form.resources');
|
||||
$data[1][] = $file;
|
||||
|
||||
return $data;
|
||||
}
|
||||
@ -203,8 +209,9 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
{
|
||||
$data = array();
|
||||
foreach ($objects as $name => $object) {
|
||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s.%s', __DIR__, $name, $this->getFormat()));
|
||||
$data[] = array($object, $description);
|
||||
$file = sprintf('%s.%s', trim($name, '.'), $this->getFormat());
|
||||
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
|
||||
$data[] = array($object, $description, $file);
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -213,18 +220,19 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
private function getContainerBuilderDescriptionTestData(array $objects)
|
||||
{
|
||||
$variations = array(
|
||||
'services' => array('show_private' => true),
|
||||
'public' => array('show_private' => false),
|
||||
'tag1' => array('show_private' => true, 'tag' => 'tag1'),
|
||||
'tags' => array('group_by' => 'tags', 'show_private' => true),
|
||||
'arguments' => array('show_private' => false, 'show_arguments' => true),
|
||||
'services' => array('show_hidden' => true),
|
||||
'public' => array('show_hidden' => false),
|
||||
'tag1' => array('show_hidden' => true, 'tag' => 'tag1'),
|
||||
'tags' => array('group_by' => 'tags', 'show_hidden' => true),
|
||||
'arguments' => array('show_hidden' => false, 'show_arguments' => true),
|
||||
);
|
||||
|
||||
$data = array();
|
||||
foreach ($objects as $name => $object) {
|
||||
foreach ($variations as $suffix => $options) {
|
||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
|
||||
$data[] = array($object, $description, $options);
|
||||
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
|
||||
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
|
||||
$data[] = array($object, $description, $options, $file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,8 +249,9 @@ abstract class AbstractDescriptorTest extends TestCase
|
||||
$data = array();
|
||||
foreach ($objects as $name => $object) {
|
||||
foreach ($variations as $suffix => $options) {
|
||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
|
||||
$data[] = array($object, $description, $options);
|
||||
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
|
||||
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
|
||||
$data[] = array($object, $description, $options, $file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,20 +107,20 @@ class ObjectsProvider
|
||||
->setSynthetic(false)
|
||||
->setLazy(true)
|
||||
->setAbstract(true)
|
||||
->addArgument(new Reference('definition2'))
|
||||
->addArgument(new Reference('.definition_2'))
|
||||
->addArgument('%parameter%')
|
||||
->addArgument(new Definition('inline_service', array('arg1', 'arg2')))
|
||||
->addArgument(array(
|
||||
'foo',
|
||||
new Reference('definition2'),
|
||||
new Reference('.definition_2'),
|
||||
new Definition('inline_service'),
|
||||
))
|
||||
->addArgument(new IteratorArgument(array(
|
||||
new Reference('definition_1'),
|
||||
new Reference('definition_2'),
|
||||
new Reference('.definition_2'),
|
||||
)))
|
||||
->setFactory(array('Full\\Qualified\\FactoryClass', 'get')),
|
||||
'definition_2' => $definition2
|
||||
'.definition_2' => $definition2
|
||||
->setPublic(false)
|
||||
->setSynthetic(true)
|
||||
->setFile('/path/to/file')
|
||||
@ -138,7 +138,7 @@ class ObjectsProvider
|
||||
{
|
||||
return array(
|
||||
'alias_1' => new Alias('service_1', true),
|
||||
'alias_2' => new Alias('service_2', false),
|
||||
'.alias_2' => new Alias('.service_2', false),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('cache');
|
||||
|
||||
$redisUrl = 'redis://localhost';
|
||||
$providerId = 'cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||
$providerId = '.cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||
|
||||
$this->assertTrue($container->hasDefinition($providerId));
|
||||
|
||||
@ -1142,7 +1142,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('cache_env_var');
|
||||
|
||||
$redisUrl = 'redis://paas.com';
|
||||
$providerId = 'cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||
$providerId = '.cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||
|
||||
$this->assertTrue($container->hasDefinition($providerId));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"service": "service_2",
|
||||
"service": ".service_2",
|
||||
"public": false
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
- Service: `service_2`
|
||||
- Public: no
|
||||
- Service: `.service_2`
|
||||
- Public: no
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
[39;49m // [39;49mThis service is an alias for the service [32mservice_2[39m
|
||||
[39;49m // [39;49mThis service is an alias for the service [32m.service_2[39m
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<alias service="service_2" public="false"/>
|
||||
<alias service=".service_2" public="false"/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"service": "service_2",
|
||||
"service": ".service_2",
|
||||
"public": false
|
||||
},
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
### alias_2
|
||||
### .alias_2
|
||||
|
||||
- Service: `service_2`
|
||||
- Service: `.service_2`
|
||||
- Public: no
|
||||
|
||||
### service_2
|
||||
### .service_2
|
||||
|
||||
- Class: `Full\Qualified\Class2`
|
||||
- Public: no
|
||||
|
@ -1,12 +1,12 @@
|
||||
[39;49m // [39;49mThis service is an alias for the service [32mservice_2[39m
|
||||
[39;49m // [39;49mThis service is an alias for the service [32m.service_2[39m
|
||||
|
||||
[33mInformation for Service "[39m[32mservice_2[39m[33m"[39m
|
||||
[33m===================================[39m
|
||||
[33mInformation for Service "[39m[32m.service_2[39m[33m"[39m
|
||||
[33m====================================[39m
|
||||
|
||||
----------------- ---------------------------------
|
||||
[32m Option [39m [32m Value [39m
|
||||
----------------- ---------------------------------
|
||||
Service ID service_2
|
||||
Service ID .service_2
|
||||
Class Full\Qualified\Class2
|
||||
[39;49m Tags tag1 ([39;49m[32mattr1[39m[39;49m: val1, [39;49m[32mattr2[39m[39;49m: val2)[39;49m[39;49m [39;49m
|
||||
[39;49m [39;49m[39;49mtag1 ([39;49m[32mattr3[39m[39;49m: val3)[39;49m[39;49m [39;49m
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<alias id="alias_2" service="service_2" public="false"/>
|
||||
<definition id="service_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<alias id=".alias_2" service=".service_2" public="false"/>
|
||||
<definition id=".service_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<factory service="factory.service" method="get"/>
|
||||
<calls>
|
||||
<call method="setMailer"/>
|
||||
|
@ -12,7 +12,7 @@
|
||||
"arguments": [
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition2"
|
||||
"id": ".definition_2"
|
||||
},
|
||||
"%parameter%",
|
||||
{
|
||||
@ -35,7 +35,7 @@
|
||||
"foo",
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition2"
|
||||
"id": ".definition_2"
|
||||
},
|
||||
{
|
||||
"class": "inline_service",
|
||||
@ -58,7 +58,7 @@
|
||||
},
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition_2"
|
||||
"id": ".definition_2"
|
||||
}
|
||||
]
|
||||
],
|
||||
@ -66,6 +66,19 @@
|
||||
"factory_class": "Full\\Qualified\\FactoryClass",
|
||||
"factory_method": "get",
|
||||
"tags": []
|
||||
},
|
||||
"service_container": {
|
||||
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
|
||||
"public": true,
|
||||
"synthetic": true,
|
||||
"lazy": false,
|
||||
"shared": true,
|
||||
"abstract": false,
|
||||
"autowire": false,
|
||||
"autoconfigure": false,
|
||||
"arguments": [],
|
||||
"file": null,
|
||||
"tags": []
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
@ -74,7 +87,5 @@
|
||||
"public": true
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
||||
}
|
||||
"services": []
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Public services
|
||||
===============
|
||||
Services
|
||||
========
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
@ -18,6 +18,18 @@ Definitions
|
||||
- Factory Class: `Full\Qualified\FactoryClass`
|
||||
- Factory Method: `get`
|
||||
|
||||
### service_container
|
||||
|
||||
- Class: `Symfony\Component\DependencyInjection\ContainerInterface`
|
||||
- Public: yes
|
||||
- Synthetic: yes
|
||||
- Lazy: no
|
||||
- Shared: yes
|
||||
- Abstract: no
|
||||
- Autowired: no
|
||||
- Autoconfigured: no
|
||||
- Arguments: no
|
||||
|
||||
|
||||
Aliases
|
||||
-------
|
||||
@ -27,8 +39,3 @@ Aliases
|
||||
- Service: `service_1`
|
||||
- Public: yes
|
||||
|
||||
|
||||
Services
|
||||
--------
|
||||
|
||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
[33mSymfony Container Public Services[39m
|
||||
[33m=================================[39m
|
||||
[33mSymfony Container Services[39m
|
||||
[33m==========================[39m
|
||||
|
||||
------------------- --------------------------------------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
------------------- --------------------------------------------------------
|
||||
alias_1 alias for "service_1"
|
||||
definition_1 Full\Qualified\Class1
|
||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
||||
------------------- --------------------------------------------------------
|
||||
------------------- ----------------------------------------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
------------------- ----------------------------------------------------------
|
||||
alias_1 alias for "service_1"
|
||||
definition_1 Full\Qualified\Class1
|
||||
service_container Symfony\Component\DependencyInjection\ContainerInterface
|
||||
------------------- ----------------------------------------------------------
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<alias id="alias_1" service="service_1" public="true"/>
|
||||
<definition id="definition_1" class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" autoconfigured="false" file="">
|
||||
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||
<argument type="service" id="definition2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
<argument>%parameter%</argument>
|
||||
<argument>
|
||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
|
||||
@ -13,15 +13,15 @@
|
||||
</argument>
|
||||
<argument type="collection">
|
||||
<argument>foo</argument>
|
||||
<argument type="service" id="definition2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
<argument>
|
||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||
</argument>
|
||||
</argument>
|
||||
<argument type="iterator">
|
||||
<argument type="service" id="definition_1"/>
|
||||
<argument type="service" id="definition_2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
</argument>
|
||||
</definition>
|
||||
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
|
||||
<definition id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||
</container>
|
||||
|
@ -13,6 +13,18 @@
|
||||
"factory_class": "Full\\Qualified\\FactoryClass",
|
||||
"factory_method": "get",
|
||||
"tags": []
|
||||
},
|
||||
"service_container": {
|
||||
"class": "Symfony\\Component\\DependencyInjection\\ContainerInterface",
|
||||
"public": true,
|
||||
"synthetic": true,
|
||||
"lazy": false,
|
||||
"shared": true,
|
||||
"abstract": false,
|
||||
"autowire": false,
|
||||
"autoconfigure": false,
|
||||
"file": null,
|
||||
"tags": []
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
@ -21,7 +33,5 @@
|
||||
"public": true
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
||||
}
|
||||
"services": []
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
Public services
|
||||
===============
|
||||
Services
|
||||
========
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
@ -17,6 +17,17 @@ Definitions
|
||||
- Factory Class: `Full\Qualified\FactoryClass`
|
||||
- Factory Method: `get`
|
||||
|
||||
### service_container
|
||||
|
||||
- Class: `Symfony\Component\DependencyInjection\ContainerInterface`
|
||||
- Public: yes
|
||||
- Synthetic: yes
|
||||
- Lazy: no
|
||||
- Shared: yes
|
||||
- Abstract: no
|
||||
- Autowired: no
|
||||
- Autoconfigured: no
|
||||
|
||||
|
||||
Aliases
|
||||
-------
|
||||
@ -26,8 +37,3 @@ Aliases
|
||||
- Service: `service_1`
|
||||
- Public: yes
|
||||
|
||||
|
||||
Services
|
||||
--------
|
||||
|
||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
[33mSymfony Container Public Services[39m
|
||||
[33m=================================[39m
|
||||
[33mSymfony Container Services[39m
|
||||
[33m==========================[39m
|
||||
|
||||
------------------- --------------------------------------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
------------------- --------------------------------------------------------
|
||||
alias_1 alias for "service_1"
|
||||
definition_1 Full\Qualified\Class1
|
||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
||||
------------------- --------------------------------------------------------
|
||||
------------------- ----------------------------------------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
------------------- ----------------------------------------------------------
|
||||
alias_1 alias for "service_1"
|
||||
definition_1 Full\Qualified\Class1
|
||||
service_container Symfony\Component\DependencyInjection\ContainerInterface
|
||||
------------------- ----------------------------------------------------------
|
||||
|
||||
|
@ -4,5 +4,5 @@
|
||||
<definition id="definition_1" class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" autoconfigured="false" file="">
|
||||
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||
</definition>
|
||||
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
|
||||
<definition id="service_container" class="Symfony\Component\DependencyInjection\ContainerInterface" public="true" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||
</container>
|
||||
|
@ -1,20 +1,6 @@
|
||||
{
|
||||
"definitions": {
|
||||
"definition_1": {
|
||||
"class": "Full\\Qualified\\Class1",
|
||||
"public": true,
|
||||
"synthetic": false,
|
||||
"lazy": true,
|
||||
"shared": true,
|
||||
"abstract": true,
|
||||
"autowire": false,
|
||||
"autoconfigure": false,
|
||||
"file": null,
|
||||
"factory_class": "Full\\Qualified\\FactoryClass",
|
||||
"factory_method": "get",
|
||||
"tags": []
|
||||
},
|
||||
"definition_2": {
|
||||
".definition_2": {
|
||||
"class": "Full\\Qualified\\Class2",
|
||||
"public": false,
|
||||
"synthetic": true,
|
||||
@ -51,16 +37,10 @@
|
||||
}
|
||||
},
|
||||
"aliases": {
|
||||
"alias_1": {
|
||||
"service": "service_1",
|
||||
"public": true
|
||||
},
|
||||
"alias_2": {
|
||||
"service": "service_2",
|
||||
".alias_2": {
|
||||
"service": ".service_2",
|
||||
"public": false
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
||||
}
|
||||
"services": []
|
||||
}
|
||||
|
@ -1,23 +1,10 @@
|
||||
Public and private services
|
||||
===========================
|
||||
Hidden services
|
||||
===============
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
|
||||
### definition_1
|
||||
|
||||
- Class: `Full\Qualified\Class1`
|
||||
- Public: yes
|
||||
- Synthetic: no
|
||||
- Lazy: yes
|
||||
- Shared: yes
|
||||
- Abstract: yes
|
||||
- Autowired: no
|
||||
- Autoconfigured: no
|
||||
- Factory Class: `Full\Qualified\FactoryClass`
|
||||
- Factory Method: `get`
|
||||
|
||||
### definition_2
|
||||
### .definition_2
|
||||
|
||||
- Class: `Full\Qualified\Class2`
|
||||
- Public: no
|
||||
@ -42,18 +29,8 @@ Definitions
|
||||
Aliases
|
||||
-------
|
||||
|
||||
### alias_1
|
||||
### .alias_2
|
||||
|
||||
- Service: `service_1`
|
||||
- Public: yes
|
||||
|
||||
### alias_2
|
||||
|
||||
- Service: `service_2`
|
||||
- Service: `.service_2`
|
||||
- Public: no
|
||||
|
||||
|
||||
Services
|
||||
--------
|
||||
|
||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
||||
|
@ -1,14 +1,11 @@
|
||||
|
||||
[33mSymfony Container Public and Private Services[39m
|
||||
[33m=============================================[39m
|
||||
[33mSymfony Container Hidden Services[39m
|
||||
[33m=================================[39m
|
||||
|
||||
------------------- --------------------------------------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
------------------- --------------------------------------------------------
|
||||
alias_1 alias for "service_1"
|
||||
alias_2 alias for "service_2"
|
||||
definition_1 Full\Qualified\Class1
|
||||
definition_2 Full\Qualified\Class2
|
||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
||||
------------------- --------------------------------------------------------
|
||||
--------------- ------------------------
|
||||
[32m Service ID [39m [32m Class name [39m
|
||||
--------------- ------------------------
|
||||
.alias_2 alias for ".service_2"
|
||||
.definition_2 Full\Qualified\Class2
|
||||
--------------- ------------------------
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container>
|
||||
<alias id="alias_1" service="service_1" public="true"/>
|
||||
<alias id="alias_2" service="service_2" public="false"/>
|
||||
<definition id="definition_1" class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" autoconfigured="false" file="">
|
||||
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||
</definition>
|
||||
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<alias id=".alias_2" service=".service_2" public="false"/>
|
||||
<definition id=".definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<factory service="factory.service" method="get"/>
|
||||
<calls>
|
||||
<call method="setMailer"/>
|
||||
@ -21,5 +17,4 @@
|
||||
<tag name="tag2"/>
|
||||
</tags>
|
||||
</definition>
|
||||
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
|
||||
</container>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"definitions": {
|
||||
"definition_2": {
|
||||
".definition_2": {
|
||||
"class": "Full\\Qualified\\Class2",
|
||||
"public": false,
|
||||
"synthetic": true,
|
||||
|
@ -1,10 +1,10 @@
|
||||
Public and private services with tag `tag1`
|
||||
===========================================
|
||||
Hidden services with tag `tag1`
|
||||
===============================
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
|
||||
### definition_2
|
||||
### .definition_2
|
||||
|
||||
- Class: `Full\Qualified\Class2`
|
||||
- Public: no
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
[33mSymfony Container Public and Private Services Tagged with "tag1" Tag[39m
|
||||
[33m====================================================================[39m
|
||||
[33mSymfony Container Hidden Services Tagged with "tag1" Tag[39m
|
||||
[33m========================================================[39m
|
||||
|
||||
-------------- ------- ------- ------- -----------------------
|
||||
[32m Service ID [39m [32m attr1 [39m [32m attr2 [39m [32m attr3 [39m [32m Class name [39m
|
||||
-------------- ------- ------- ------- -----------------------
|
||||
definition_2 val1 val2 Full\Qualified\Class2
|
||||
" val3
|
||||
-------------- ------- ------- ------- -----------------------
|
||||
--------------- ------- ------- ------- -----------------------
|
||||
[32m Service ID [39m [32m attr1 [39m [32m attr2 [39m [32m attr3 [39m [32m Class name [39m
|
||||
--------------- ------- ------- ------- -----------------------
|
||||
.definition_2 val1 val2 Full\Qualified\Class2
|
||||
" val3
|
||||
--------------- ------- ------- ------- -----------------------
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container>
|
||||
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<definition id=".definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<factory service="factory.service" method="get"/>
|
||||
<calls>
|
||||
<call method="setMailer"/>
|
||||
|
@ -4,7 +4,7 @@ Container tags
|
||||
tag1
|
||||
----
|
||||
|
||||
### definition_2
|
||||
### .definition_2
|
||||
|
||||
- Class: `Full\Qualified\Class2`
|
||||
- Public: no
|
||||
@ -23,7 +23,7 @@ tag1
|
||||
tag2
|
||||
----
|
||||
|
||||
### definition_2
|
||||
### .definition_2
|
||||
|
||||
- Class: `Full\Qualified\Class2`
|
||||
- Public: no
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
[33mSymfony Container Public and Private Tags[39m
|
||||
[33m=========================================[39m
|
||||
[33mSymfony Container Hidden Tags[39m
|
||||
[33m=============================[39m
|
||||
|
||||
[33m"tag1" tag[39m
|
||||
[33m----------[39m
|
||||
|
||||
* definition_2
|
||||
* .definition_2
|
||||
|
||||
[33m"tag2" tag[39m
|
||||
[33m----------[39m
|
||||
|
||||
* definition_2
|
||||
* .definition_2
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container>
|
||||
<tag name="tag1">
|
||||
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<definition id=".definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<factory service="factory.service" method="get"/>
|
||||
<calls>
|
||||
<call method="setMailer"/>
|
||||
@ -9,7 +9,7 @@
|
||||
</definition>
|
||||
</tag>
|
||||
<tag name="tag2">
|
||||
<definition id="definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<definition id=".definition_2" class="Full\Qualified\Class2" public="false" synthetic="true" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="/path/to/file">
|
||||
<factory service="factory.service" method="get"/>
|
||||
<calls>
|
||||
<call method="setMailer"/>
|
||||
|
@ -10,7 +10,7 @@
|
||||
"arguments": [
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition2"
|
||||
"id": ".definition_2"
|
||||
},
|
||||
"%parameter%",
|
||||
{
|
||||
@ -33,7 +33,7 @@
|
||||
"foo",
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition2"
|
||||
"id": ".definition_2"
|
||||
},
|
||||
{
|
||||
"class": "inline_service",
|
||||
@ -56,7 +56,7 @@
|
||||
},
|
||||
{
|
||||
"type": "service",
|
||||
"id": "definition_2"
|
||||
"id": ".definition_2"
|
||||
}
|
||||
]
|
||||
],
|
||||
|
@ -13,7 +13,7 @@
|
||||
Autoconfigured no
|
||||
Factory Class Full\Qualified\FactoryClass
|
||||
Factory Method get
|
||||
[39;49m Arguments Service(definition2)[39;49m[39;49m [39;49m
|
||||
[39;49m Arguments Service(.definition_2)[39;49m[39;49m [39;49m
|
||||
[39;49m [39;49m[39;49m%parameter%[39;49m[39;49m [39;49m
|
||||
[39;49m [39;49m[39;49mInlined Service[39;49m[39;49m [39;49m
|
||||
[39;49m [39;49m[39;49mArray (3 element(s))[39;49m[39;49m [39;49m
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definition class="Full\Qualified\Class1" public="true" synthetic="false" lazy="true" shared="true" abstract="true" autowired="false" autoconfigured="false" file="">
|
||||
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||
<argument type="service" id="definition2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
<argument>%parameter%</argument>
|
||||
<argument>
|
||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
|
||||
@ -11,13 +11,13 @@
|
||||
</argument>
|
||||
<argument type="collection">
|
||||
<argument>foo</argument>
|
||||
<argument type="service" id="definition2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
<argument>
|
||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||
</argument>
|
||||
</argument>
|
||||
<argument type="iterator">
|
||||
<argument type="service" id="definition_1"/>
|
||||
<argument type="service" id="definition_2"/>
|
||||
<argument type="service" id=".definition_2"/>
|
||||
</argument>
|
||||
</definition>
|
||||
|
@ -16,4 +16,4 @@
|
||||
- Attr2: val2
|
||||
- Tag: `tag1`
|
||||
- Attr3: val3
|
||||
- Tag: `tag2`
|
||||
- Tag: `tag2`
|
||||
|
@ -55,12 +55,12 @@ class ContainerDebugCommandTest extends WebTestCase
|
||||
$application->setAutoExit(false);
|
||||
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(array('command' => 'debug:container', '--show-private' => true));
|
||||
$this->assertContains('public', $tester->getDisplay());
|
||||
$this->assertContains('private_alias', $tester->getDisplay());
|
||||
$tester->run(array('command' => 'debug:container', '--show-hidden' => true));
|
||||
$this->assertNotContains('public', $tester->getDisplay());
|
||||
$this->assertNotContains('private_alias', $tester->getDisplay());
|
||||
|
||||
$tester->run(array('command' => 'debug:container'));
|
||||
$this->assertContains('public', $tester->getDisplay());
|
||||
$this->assertNotContains('private_alias', $tester->getDisplay());
|
||||
$this->assertContains('private_alias', $tester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ class SecurityExtension extends Extension
|
||||
|
||||
private function createExpression($container, $expression)
|
||||
{
|
||||
if (isset($this->expressions[$id = 'security.expression.'.ContainerBuilder::hash($expression)])) {
|
||||
if (isset($this->expressions[$id = '.security.expression.'.ContainerBuilder::hash($expression)])) {
|
||||
return $this->expressions[$id];
|
||||
}
|
||||
|
||||
@ -660,7 +660,7 @@ class SecurityExtension extends Extension
|
||||
$methods = array_map('strtoupper', (array) $methods);
|
||||
}
|
||||
|
||||
$id = 'security.request_matcher.'.ContainerBuilder::hash(array($path, $host, $methods, $ip, $attributes));
|
||||
$id = '.security.request_matcher.'.ContainerBuilder::hash(array($path, $host, $methods, $ip, $attributes));
|
||||
|
||||
if (isset($this->requestMatchers[$id])) {
|
||||
return $this->requestMatchers[$id];
|
||||
|
@ -84,7 +84,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
array(
|
||||
'simple',
|
||||
'security.user_checker',
|
||||
'security.request_matcher.6tndozi',
|
||||
'.security.request_matcher.6tndozi',
|
||||
false,
|
||||
),
|
||||
array(
|
||||
@ -117,7 +117,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
array(
|
||||
'host',
|
||||
'security.user_checker',
|
||||
'security.request_matcher.and0kk1',
|
||||
'.security.request_matcher.and0kk1',
|
||||
true,
|
||||
false,
|
||||
'security.user.provider.concrete.default',
|
||||
|
@ -90,7 +90,7 @@ class AutowirePass extends AbstractRecursivePass
|
||||
|
||||
if (ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
|
||||
// since the error message varies by referenced id and $this->currentId, so should the id of the dummy errored definition
|
||||
$this->container->register($id = sprintf('_errored.%s.%s', $this->currentId, (string) $value), $value->getType())
|
||||
$this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, (string) $value), $value->getType())
|
||||
->addError($message);
|
||||
|
||||
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
||||
|
@ -75,8 +75,8 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
||||
foreach ($instanceofDefs as $key => $instanceofDef) {
|
||||
/** @var ChildDefinition $instanceofDef */
|
||||
$instanceofDef = clone $instanceofDef;
|
||||
$instanceofDef->setAbstract(true)->setParent($parent ?: 'abstract.instanceof.'.$id);
|
||||
$parent = 'instanceof.'.$interface.'.'.$key.'.'.$id;
|
||||
$instanceofDef->setAbstract(true)->setParent($parent ?: '.abstract.instanceof.'.$id);
|
||||
$parent = '.instanceof.'.$interface.'.'.$key.'.'.$id;
|
||||
$container->setDefinition($parent, $instanceofDef);
|
||||
$instanceofTags[] = $instanceofDef->getTags();
|
||||
|
||||
@ -95,7 +95,7 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
||||
|
||||
if ($parent) {
|
||||
$bindings = $definition->getBindings();
|
||||
$abstract = $container->setDefinition('abstract.instanceof.'.$id, $definition);
|
||||
$abstract = $container->setDefinition('.abstract.instanceof.'.$id, $definition);
|
||||
|
||||
// cast Definition to ChildDefinition
|
||||
$definition->setBindings(array());
|
||||
|
@ -105,7 +105,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
|
||||
$e = new ServiceNotFoundException($id, $this->currentId);
|
||||
|
||||
// since the error message varies by $id and $this->currentId, so should the id of the dummy errored definition
|
||||
$this->container->register($id = sprintf('_errored.%s.%s', $this->currentId, $id), $value->getType())
|
||||
$this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, $id), $value->getType())
|
||||
->addError($e->getMessage());
|
||||
|
||||
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
||||
|
@ -54,7 +54,7 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass
|
||||
|
||||
$value->setArguments($arguments);
|
||||
|
||||
$id = 'service_locator.'.ContainerBuilder::hash($value);
|
||||
$id = '.service_locator.'.ContainerBuilder::hash($value);
|
||||
|
||||
if ($isRoot) {
|
||||
if ($id !== $this->currentId) {
|
||||
@ -91,7 +91,7 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass
|
||||
->setPublic(false)
|
||||
->addTag('container.service_locator');
|
||||
|
||||
if (!$container->has($id = 'service_locator.'.ContainerBuilder::hash($locator))) {
|
||||
if (!$container->has($id = '.service_locator.'.ContainerBuilder::hash($locator))) {
|
||||
$container->setDefinition($id, $locator);
|
||||
}
|
||||
|
||||
|
@ -262,6 +262,9 @@ class Container implements ResettableContainerInterface
|
||||
|
||||
$alternatives = array();
|
||||
foreach ($this->getServiceIds() as $knownId) {
|
||||
if ('' === $knownId || '.' === $knownId[0]) {
|
||||
continue;
|
||||
}
|
||||
$lev = levenshtein($id, $knownId);
|
||||
if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
|
||||
$alternatives[] = $knownId;
|
||||
|
@ -79,7 +79,7 @@ class ServicesConfigurator extends AbstractConfigurator
|
||||
throw new \LogicException('Anonymous services must have a class name.');
|
||||
}
|
||||
|
||||
$id = sprintf('%d_%s', ++$this->anonymousCount, preg_replace('/^.*\\\\/', '', $class).'~'.$this->anonymousHash);
|
||||
$id = sprintf('.%d_%s', ++$this->anonymousCount, preg_replace('/^.*\\\\/', '', $class).'~'.$this->anonymousHash);
|
||||
$definition->setPublic(false);
|
||||
} else {
|
||||
$definition->setPublic($defaults->isPublic());
|
||||
|
@ -409,7 +409,7 @@ class XmlFileLoader extends FileLoader
|
||||
foreach ($nodes as $node) {
|
||||
if ($services = $this->getChildren($node, 'service')) {
|
||||
// give it a unique name
|
||||
$id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).'~'.$suffix);
|
||||
$id = sprintf('.%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).'~'.$suffix);
|
||||
$node->setAttribute('id', $id);
|
||||
$node->setAttribute('service', $id);
|
||||
|
||||
|
@ -708,7 +708,7 @@ class YamlFileLoader extends FileLoader
|
||||
$instanceof = $this->instanceof;
|
||||
$this->instanceof = array();
|
||||
|
||||
$id = sprintf('%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '').$this->anonymousServicesSuffix);
|
||||
$id = sprintf('.%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '').$this->anonymousServicesSuffix);
|
||||
$this->parseDefinition($id, $argument, $file, array());
|
||||
|
||||
if (!$this->container->hasDefinition($id)) {
|
||||
|
@ -882,6 +882,6 @@ class AutowirePassTest extends TestCase
|
||||
|
||||
$erroredDefinition = new Definition(MissingClass::class);
|
||||
|
||||
$this->assertEquals($erroredDefinition->addError('Cannot autowire service "some_locator": it has type "Symfony\Component\DependencyInjection\Tests\Compiler\MissingClass" but this class was not found.'), $container->getDefinition('_errored.some_locator.'.MissingClass::class));
|
||||
$this->assertEquals($erroredDefinition->addError('Cannot autowire service "some_locator": it has type "Symfony\Component\DependencyInjection\Tests\Compiler\MissingClass" but this class was not found.'), $container->getDefinition('.errored.some_locator.'.MissingClass::class));
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
|
||||
|
||||
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||
|
||||
$parent = 'instanceof.'.parent::class.'.0.foo';
|
||||
$parent = '.instanceof.'.parent::class.'.0.foo';
|
||||
$def = $container->getDefinition('foo');
|
||||
$this->assertEmpty($def->getInstanceofConditionals());
|
||||
$this->assertInstanceOf(ChildDefinition::class, $def);
|
||||
@ -260,7 +260,7 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
|
||||
|
||||
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||
|
||||
$abstract = $container->getDefinition('abstract.instanceof.bar');
|
||||
$abstract = $container->getDefinition('.abstract.instanceof.bar');
|
||||
|
||||
$this->assertEmpty($abstract->getArguments());
|
||||
$this->assertEmpty($abstract->getMethodCalls());
|
||||
|
@ -8,7 +8,7 @@ services:
|
||||
class: Bar\FooClass
|
||||
public: true
|
||||
arguments: [!tagged listener]
|
||||
2_stdClass~%s:
|
||||
.2_stdClass~%s:
|
||||
class: stdClass
|
||||
public: false
|
||||
tags:
|
||||
|
@ -54,11 +54,11 @@ class ProjectServiceContainer extends Container
|
||||
public function getRemovedIds()
|
||||
{
|
||||
return array(
|
||||
'.service_locator.ljJrY4L' => true,
|
||||
'.service_locator.ljJrY4L.foo_service' => true,
|
||||
'Psr\\Container\\ContainerInterface' => true,
|
||||
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true,
|
||||
'service_locator.ljJrY4L' => true,
|
||||
'service_locator.ljJrY4L.foo_service' => true,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ class YamlFileLoaderTest extends TestCase
|
||||
$this->assertCount(1, $args);
|
||||
$this->assertInstanceOf(Reference::class, $args[0]);
|
||||
$this->assertTrue($container->has((string) $args[0]));
|
||||
$this->assertRegExp('/^\d+_Bar[._A-Za-z0-9]{7}$/', (string) $args[0]);
|
||||
$this->assertRegExp('/^\.\d+_Bar[._A-Za-z0-9]{7}$/', (string) $args[0]);
|
||||
|
||||
$anonymous = $container->getDefinition((string) $args[0]);
|
||||
$this->assertEquals('Bar', $anonymous->getClass());
|
||||
@ -567,7 +567,7 @@ class YamlFileLoaderTest extends TestCase
|
||||
$this->assertInternalType('array', $factory);
|
||||
$this->assertInstanceOf(Reference::class, $factory[0]);
|
||||
$this->assertTrue($container->has((string) $factory[0]));
|
||||
$this->assertRegExp('/^\d+_Quz[._A-Za-z0-9]{7}$/', (string) $factory[0]);
|
||||
$this->assertRegExp('/^\.\d+_Quz[._A-Za-z0-9]{7}$/', (string) $factory[0]);
|
||||
$this->assertEquals('constructFoo', $factory[1]);
|
||||
|
||||
$anonymous = $container->getDefinition((string) $factory[0]);
|
||||
|
@ -139,7 +139,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
||||
$binding->setValues(array($bindingValue, $bindingId, true));
|
||||
|
||||
if (!$bindingValue instanceof Reference) {
|
||||
$args[$p->name] = new Reference('_value.'.$container->hash($bindingValue));
|
||||
$args[$p->name] = new Reference('.value.'.$container->hash($bindingValue));
|
||||
$container->register((string) $args[$p->name], 'mixed')
|
||||
->setFactory('current')
|
||||
->addArgument(array($bindingValue));
|
||||
|
Reference in New Issue
Block a user