diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index 9830609d96..f40e6cc233 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -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 --typesphp %command.full_name% --types -By default, private services are hidden. You can display all services by -using the --show-private flag: - - php %command.full_name% --show-private - Use the --tags option to display tagged public services grouped by tag: php %command.full_name% --tags @@ -93,6 +89,11 @@ Display a specific parameter by specifying its name with the --parameterphp %command.full_name% --parameter=kernel.debug +By default, internal services are hidden. You can display them +using the --show-hidden flag: + + php %command.full_name% --show-hidden + 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); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php index 043b4fff6e..7161a18cec 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php @@ -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; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index 7b87fcf896..90747f4fd8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -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); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 8836cc234b..f96b684dc0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -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; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index cc9aa50573..af88a82bbb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -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; - } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 1e3148db9a..8498318126 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -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; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php index ae8415cb4e..2530d9e75e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php @@ -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')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php index ab5c95a7d8..e186395214 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php @@ -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); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php index ce5cc7880b..3c5917934f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php @@ -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), ); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 5157944c7a..56998dcd6c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1075,7 +1075,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)); @@ -1089,7 +1089,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)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.json index 6998dae282..df17ea15e4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.json @@ -1,4 +1,4 @@ { - "service": "service_2", + "service": ".service_2", "public": false } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md index 73a4101d8b..4373d2e055 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.md @@ -1,2 +1,2 @@ -- Service: `service_2` -- Public: no \ No newline at end of file +- Service: `.service_2` +- Public: no diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt index 0dbee6ac67..d4d8a41cbf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.txt @@ -1,3 +1,3 @@ - // This service is an alias for the service service_2 + // This service is an alias for the service .service_2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.xml index 847050b33a..55adaf323b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_2.xml @@ -1,2 +1,2 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.json index 03780e3eeb..2fb039a9fa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.json @@ -1,6 +1,6 @@ [ { - "service": "service_2", + "service": ".service_2", "public": false }, { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.md index 406c5dcada..7894367566 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.md @@ -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 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.txt index 735fe0130d..aaa6d658bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.txt @@ -1,12 +1,12 @@ - // This service is an alias for the service service_2 + // This service is an alias for the service .service_2 -Information for Service "service_2" -=================================== +Information for Service ".service_2" +==================================== ----------------- ---------------------------------  Option   Value  ----------------- --------------------------------- - Service ID service_2 + Service ID .service_2 Class Full\Qualified\Class2  Tags tag1 (attr1: val1, attr2: val2)   tag1 (attr3: val3)  diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.xml index 3c15460bee..bbb7b92e44 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/alias_with_definition_2.xml @@ -1,6 +1,6 @@ - - + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.json index df76274db6..bcafe91b64 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.json @@ -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": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.md index 757da8278c..2ace4d31cb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.md @@ -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` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.txt index 87f6b2125d..5ab36e2ebf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.txt @@ -1,12 +1,12 @@ -Symfony Container Public Services -================================= +Symfony Container Services +========================== - ------------------- -------------------------------------------------------- -  Service ID   Class name  - ------------------- -------------------------------------------------------- - alias_1 alias for "service_1" - definition_1 Full\Qualified\Class1 - service_container Symfony\Component\DependencyInjection\ContainerBuilder - ------------------- -------------------------------------------------------- + ------------------- ---------------------------------------------------------- +  Service ID   Class name  + ------------------- ---------------------------------------------------------- + alias_1 alias for "service_1" + definition_1 Full\Qualified\Class1 + service_container Symfony\Component\DependencyInjection\ContainerInterface + ------------------- ---------------------------------------------------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.xml index 59811b00d3..6efe597d8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_arguments.xml @@ -3,7 +3,7 @@ - + %parameter% @@ -13,15 +13,15 @@ foo - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 3419083f57..bb1ef32595 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -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": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md index b8c62be4bc..fedb514965 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md @@ -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` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt index 87f6b2125d..5ab36e2ebf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.txt @@ -1,12 +1,12 @@ -Symfony Container Public Services -================================= +Symfony Container Services +========================== - ------------------- -------------------------------------------------------- -  Service ID   Class name  - ------------------- -------------------------------------------------------- - alias_1 alias for "service_1" - definition_1 Full\Qualified\Class1 - service_container Symfony\Component\DependencyInjection\ContainerBuilder - ------------------- -------------------------------------------------------- + ------------------- ---------------------------------------------------------- +  Service ID   Class name  + ------------------- ---------------------------------------------------------- + alias_1 alias for "service_1" + definition_1 Full\Qualified\Class1 + service_container Symfony\Component\DependencyInjection\ContainerInterface + ------------------- ---------------------------------------------------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml index ac92a28ef6..66aba252af 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.xml @@ -4,5 +4,5 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index becd607b79..0eda1932f7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -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": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md index 54655668b4..2d0edfd019 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md @@ -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` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt index e23ea6d81f..82b4909242 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.txt @@ -1,14 +1,11 @@ -Symfony Container Public and Private Services -============================================= +Symfony Container Hidden Services +================================= - ------------------- -------------------------------------------------------- -  Service ID   Class name  - ------------------- -------------------------------------------------------- - 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 - ------------------- -------------------------------------------------------- + --------------- ------------------------ +  Service ID   Class name  + --------------- ------------------------ + .alias_2 alias for ".service_2" + .definition_2 Full\Qualified\Class2 + --------------- ------------------------ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml index 54da4f4f48..a311a2e2bb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.xml @@ -1,11 +1,7 @@ - - - - - - + + @@ -21,5 +17,4 @@ - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index fb9634f67a..caba59cd5b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -1,6 +1,6 @@ { "definitions": { - "definition_2": { + ".definition_2": { "class": "Full\\Qualified\\Class2", "public": false, "synthetic": true, diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md index 9895f1fb5d..a7a03bc391 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md @@ -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 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt index b8b393266a..33c96b30d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.txt @@ -1,11 +1,11 @@ -Symfony Container Public and Private Services Tagged with "tag1" Tag -==================================================================== +Symfony Container Hidden Services Tagged with "tag1" Tag +======================================================== - -------------- ------- ------- ------- ----------------------- -  Service ID   attr1   attr2   attr3   Class name  - -------------- ------- ------- ------- ----------------------- - definition_2 val1 val2 Full\Qualified\Class2 - " val3 - -------------- ------- ------- ------- ----------------------- + --------------- ------- ------- ------- ----------------------- +  Service ID   attr1   attr2   attr3   Class name  + --------------- ------- ------- ------- ----------------------- + .definition_2 val1 val2 Full\Qualified\Class2 + " val3 + --------------- ------- ------- ------- ----------------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml index 9c39b653dd..6dd2fc6173 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.xml @@ -1,6 +1,6 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md index 205596259d..563ce2d2ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md @@ -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 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.txt index 45523dcb68..b10e4661f6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.txt @@ -1,14 +1,14 @@ -Symfony Container Public and Private Tags -========================================= +Symfony Container Hidden Tags +============================= "tag1" tag ---------- - * definition_2 + * .definition_2 "tag2" tag ---------- - * definition_2 + * .definition_2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml index 4e98e77a19..77975ee27c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.xml @@ -1,7 +1,7 @@ - + @@ -9,7 +9,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.json index 2568b87dec..209557d5ba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.json @@ -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" } ] ], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt index 989f96ee13..b73eeedad6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.txt @@ -13,7 +13,7 @@ Autoconfigured no Factory Class Full\Qualified\FactoryClass Factory Method get - Arguments Service(definition2)  + Arguments Service(.definition_2)   %parameter%   Inlined Service   Array (3 element(s))  diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.xml index e250060d75..c3a099c152 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_1.xml @@ -1,7 +1,7 @@ - + %parameter% @@ -11,13 +11,13 @@ foo - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_2.md index abe7dd475d..e9f0efbd10 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_arguments_2.md @@ -16,4 +16,4 @@ - Attr2: val2 - Tag: `tag1` - Attr3: val3 -- Tag: `tag2` \ No newline at end of file +- Tag: `tag2` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index d19b08f739..4bdf7592b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -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()); } } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index 88ab775770..137ba47c04 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -634,7 +634,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]; } @@ -657,7 +657,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]; diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index f6237ad1ed..1366a2608c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -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', diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 51d1e419ed..bb0f1b3e4f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -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()); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php index 15110261a2..cf58f303f5 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php @@ -77,8 +77,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(); $instanceofDef->setTags(array()); @@ -91,7 +91,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()); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php index d894a2f990..97f4c1978d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php @@ -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()); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php index fb32d501ac..3969c74fcb 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php @@ -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); } diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 2afd451849..2b3ab61e42 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -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; diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php index ce122dcec9..978bb87a71 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php @@ -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()); diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 7c89984cef..fbffdb127f 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -408,7 +408,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); diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 81584f57ef..b3c0c99d5e 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -707,7 +707,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)) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index aebb66863f..21bdda7698 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -862,6 +862,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)); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index 21a2810578..7269f2bf54 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -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); @@ -242,7 +242,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()); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml index 3f26138991..b425e53cb9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/config/anonymous.expected.yml @@ -8,7 +8,7 @@ services: class: Bar\FooClass public: true arguments: [!tagged listener] - 2_stdClass~%s: + .2_stdClass~%s: class: stdClass public: false tags: diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php index 7ed23ebf7d..2c887e0e21 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_subscriber.php @@ -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, ); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index df625bb013..ac11c92ffa 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -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]); diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index 824b14967f..cd76e56caa 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -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));