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
|
$this
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'),
|
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-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('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('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'),
|
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>
|
<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:
|
Use the --tags option to display tagged <comment>public</comment> services grouped by tag:
|
||||||
|
|
||||||
<info>php %command.full_name% --tags</info>
|
<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>
|
<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
|
EOF
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
@ -103,6 +104,10 @@ EOF
|
|||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
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);
|
$io = new SymfonyStyle($input, $output);
|
||||||
$errorIo = $io->getErrorStyle();
|
$errorIo = $io->getErrorStyle();
|
||||||
|
|
||||||
@ -110,7 +115,7 @@ EOF
|
|||||||
$object = $this->getContainerBuilder();
|
$object = $this->getContainerBuilder();
|
||||||
|
|
||||||
if ($input->getOption('types')) {
|
if ($input->getOption('types')) {
|
||||||
$options = array('show_private' => true);
|
$options = array();
|
||||||
$options['filter'] = array($this, 'filterToServiceTypes');
|
$options['filter'] = array($this, 'filterToServiceTypes');
|
||||||
} elseif ($input->getOption('parameters')) {
|
} elseif ($input->getOption('parameters')) {
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
@ -122,19 +127,20 @@ EOF
|
|||||||
} elseif ($parameter = $input->getOption('parameter')) {
|
} elseif ($parameter = $input->getOption('parameter')) {
|
||||||
$options = array('parameter' => $parameter);
|
$options = array('parameter' => $parameter);
|
||||||
} elseif ($input->getOption('tags')) {
|
} 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')) {
|
} elseif ($tag = $input->getOption('tag')) {
|
||||||
$options = array('tag' => $tag, 'show_private' => $input->getOption('show-private'));
|
$options = array('tag' => $tag);
|
||||||
} elseif ($name = $input->getArgument('name')) {
|
} elseif ($name = $input->getArgument('name')) {
|
||||||
$name = $this->findProperServiceName($input, $errorIo, $object, $name);
|
$name = $this->findProperServiceName($input, $errorIo, $object, $name);
|
||||||
$options = array('id' => $name);
|
$options = array('id' => $name);
|
||||||
} else {
|
} else {
|
||||||
$options = array('show_private' => $input->getOption('show-private'));
|
$options = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$helper = new DescriptorHelper();
|
$helper = new DescriptorHelper();
|
||||||
$options['format'] = $input->getOption('format');
|
$options['format'] = $input->getOption('format');
|
||||||
$options['show_arguments'] = $input->getOption('show-arguments');
|
$options['show_arguments'] = $input->getOption('show-arguments');
|
||||||
|
$options['show_hidden'] = $input->getOption('show-hidden');
|
||||||
$options['raw_text'] = $input->getOption('raw');
|
$options['raw_text'] = $input->getOption('raw');
|
||||||
$options['output'] = $io;
|
$options['output'] = $io;
|
||||||
$helper->describe($io, $object, $options);
|
$helper->describe($io, $object, $options);
|
||||||
|
@ -15,6 +15,7 @@ use Symfony\Component\Console\Descriptor\DescriptorInterface;
|
|||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\DependencyInjection\Alias;
|
use Symfony\Component\DependencyInjection\Alias;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
@ -230,17 +231,21 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
return $builder->getAlias($serviceId);
|
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
|
// the service has been injected in some special way, just return the service
|
||||||
return $builder->get($serviceId);
|
return $builder->get($serviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $builder
|
* @param ContainerBuilder $builder
|
||||||
* @param bool $showPrivate
|
* @param bool $showHidden
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function findDefinitionsByTag(ContainerBuilder $builder, $showPrivate)
|
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden)
|
||||||
{
|
{
|
||||||
$definitions = array();
|
$definitions = array();
|
||||||
$tags = $builder->findTags();
|
$tags = $builder->findTags();
|
||||||
@ -250,7 +255,7 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) {
|
foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) {
|
||||||
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
$definition = $this->resolveServiceDefinition($builder, $serviceId);
|
||||||
|
|
||||||
if (!$definition instanceof Definition || !$showPrivate && !$definition->isPublic()) {
|
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,10 +63,10 @@ class JsonDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
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();
|
$data = array();
|
||||||
|
|
||||||
foreach ($this->findDefinitionsByTag($builder, $showPrivate) as $tag => $definitions) {
|
foreach ($this->findDefinitionsByTag($builder, $showHidden) as $tag => $definitions) {
|
||||||
$data[$tag] = array();
|
$data[$tag] = array();
|
||||||
foreach ($definitions as $definition) {
|
foreach ($definitions as $definition) {
|
||||||
$data[$tag][] = $this->getContainerDefinitionData($definition, true);
|
$data[$tag][] = $this->getContainerDefinitionData($definition, true);
|
||||||
@ -100,7 +100,7 @@ class JsonDescriptor extends Descriptor
|
|||||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
||||||
{
|
{
|
||||||
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
|
$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'];
|
$omitTags = isset($options['omit_tags']) && $options['omit_tags'];
|
||||||
$showArguments = isset($options['show_arguments']) && $options['show_arguments'];
|
$showArguments = isset($options['show_arguments']) && $options['show_arguments'];
|
||||||
$data = array('definitions' => array(), 'aliases' => array(), 'services' => array());
|
$data = array('definitions' => array(), 'aliases' => array(), 'services' => array());
|
||||||
@ -112,14 +112,14 @@ class JsonDescriptor extends Descriptor
|
|||||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||||
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
||||||
|
|
||||||
|
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($service instanceof Alias) {
|
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) {
|
} 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 {
|
} else {
|
||||||
$data['services'][$serviceId] = get_class($service);
|
$data['services'][$serviceId] = get_class($service);
|
||||||
}
|
}
|
||||||
|
@ -82,10 +82,10 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
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==============");
|
$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)));
|
$this->write("\n\n".$tag."\n".str_repeat('-', strlen($tag)));
|
||||||
foreach ($definitions as $serviceId => $definition) {
|
foreach ($definitions as $serviceId => $definition) {
|
||||||
$this->write("\n\n");
|
$this->write("\n\n");
|
||||||
@ -119,9 +119,9 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
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'])) {
|
if (isset($options['tag'])) {
|
||||||
$title .= ' with tag `'.$options['tag'].'`';
|
$title .= ' with tag `'.$options['tag'].'`';
|
||||||
}
|
}
|
||||||
@ -138,14 +138,14 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||||
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
$service = $this->resolveServiceDefinition($builder, $serviceId);
|
||||||
|
|
||||||
|
if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($service instanceof Alias) {
|
if ($service instanceof Alias) {
|
||||||
if ($showPrivate || ($service->isPublic() && !$service->isPrivate())) {
|
$services['aliases'][$serviceId] = $service;
|
||||||
$services['aliases'][$serviceId] = $service;
|
|
||||||
}
|
|
||||||
} elseif ($service instanceof Definition) {
|
} elseif ($service instanceof Definition) {
|
||||||
if (($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
|
$services['definitions'][$serviceId] = $service;
|
||||||
$services['definitions'][$serviceId] = $service;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$services['services'][$serviceId] = $service;
|
$services['services'][$serviceId] = $service;
|
||||||
}
|
}
|
||||||
|
@ -122,15 +122,15 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerTags(ContainerBuilder $builder, array $options = array())
|
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) {
|
if ($showHidden) {
|
||||||
$options['output']->title('Symfony Container Public and Private Tags');
|
$options['output']->title('Symfony Container Hidden Tags');
|
||||||
} else {
|
} 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']->section(sprintf('"%s" tag', $tag));
|
||||||
$options['output']->listing(array_keys($definitions));
|
$options['output']->listing(array_keys($definitions));
|
||||||
}
|
}
|
||||||
@ -165,13 +165,13 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
protected function describeContainerServices(ContainerBuilder $builder, array $options = array())
|
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;
|
$showTag = isset($options['tag']) ? $options['tag'] : null;
|
||||||
|
|
||||||
if ($showPrivate) {
|
if ($showHidden) {
|
||||||
$title = 'Symfony Container Public and Private Services';
|
$title = 'Symfony Container Hidden Services';
|
||||||
} else {
|
} else {
|
||||||
$title = 'Symfony Container Public Services';
|
$title = 'Symfony Container Services';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($showTag) {
|
if ($showTag) {
|
||||||
@ -189,12 +189,14 @@ class TextDescriptor extends Descriptor
|
|||||||
|
|
||||||
foreach ($serviceIds as $key => $serviceId) {
|
foreach ($serviceIds as $key => $serviceId) {
|
||||||
$definition = $this->resolveServiceDefinition($builder, $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) {
|
if ($definition instanceof Definition) {
|
||||||
// filter out private services unless shown explicitly
|
|
||||||
if (!$showPrivate && (!$definition->isPublic() || $definition->isPrivate())) {
|
|
||||||
unset($serviceIds[$key]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($showTag) {
|
if ($showTag) {
|
||||||
$tags = $definition->getTag($showTag);
|
$tags = $definition->getTag($showTag);
|
||||||
foreach ($tags as $tag) {
|
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())
|
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())
|
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;
|
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 = new \DOMDocument('1.0', 'UTF-8');
|
||||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
$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'));
|
$containerXML->appendChild($tagXML = $dom->createElement('tag'));
|
||||||
$tagXML->setAttribute('name', $tag);
|
$tagXML->setAttribute('name', $tag);
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
return $dom;
|
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 = new \DOMDocument('1.0', 'UTF-8');
|
||||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
$dom->appendChild($containerXML = $dom->createElement('container'));
|
||||||
@ -283,7 +283,7 @@ class XmlDescriptor extends Descriptor
|
|||||||
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
|
||||||
$service = $this->resolveServiceDefinition($builder, $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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ class CachePoolPass implements CompilerPassInterface
|
|||||||
if ($usedEnvs || preg_match('#^[a-z]++://#', $name)) {
|
if ($usedEnvs || preg_match('#^[a-z]++://#', $name)) {
|
||||||
$dsn = $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 = new Definition(AbstractAdapter::class);
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
$definition->setFactory(array(AbstractAdapter::class, 'createConnection'));
|
$definition->setFactory(array(AbstractAdapter::class, 'createConnection'));
|
||||||
|
@ -119,7 +119,7 @@ abstract class AbstractDescriptorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$builder = current(ObjectsProvider::getContainerBuilders());
|
$builder = current(ObjectsProvider::getContainerBuilders());
|
||||||
$builder->setDefinition('service_1', $builder->getDefinition('definition_1'));
|
$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();
|
$aliases = ObjectsProvider::getContainerAliases();
|
||||||
$aliasesWithDefinitions = array();
|
$aliasesWithDefinitions = array();
|
||||||
@ -130,8 +130,10 @@ abstract class AbstractDescriptorTest extends TestCase
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
$data = $this->getDescriptionTestData($aliasesWithDefinitions);
|
$data = $this->getDescriptionTestData($aliasesWithDefinitions);
|
||||||
foreach ($aliases as $name => $alias) {
|
foreach ($aliases as $name => $alias) {
|
||||||
|
$file = array_pop($data[$i]);
|
||||||
$data[$i][] = $builder;
|
$data[$i][] = $builder;
|
||||||
$data[$i][] = array('id' => $name);
|
$data[$i][] = array('id' => $name);
|
||||||
|
$data[$i][] = $file;
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +150,12 @@ abstract class AbstractDescriptorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
|
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
|
||||||
|
|
||||||
|
$file = array_pop($data[0]);
|
||||||
$data[0][] = array('parameter' => 'database_name');
|
$data[0][] = array('parameter' => 'database_name');
|
||||||
|
$data[0][] = $file;
|
||||||
|
$file = array_pop($data[1]);
|
||||||
$data[1][] = array('parameter' => 'twig.form.resources');
|
$data[1][] = array('parameter' => 'twig.form.resources');
|
||||||
|
$data[1][] = $file;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -203,8 +209,9 @@ abstract class AbstractDescriptorTest extends TestCase
|
|||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($objects as $name => $object) {
|
foreach ($objects as $name => $object) {
|
||||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s.%s', __DIR__, $name, $this->getFormat()));
|
$file = sprintf('%s.%s', trim($name, '.'), $this->getFormat());
|
||||||
$data[] = array($object, $description);
|
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
|
||||||
|
$data[] = array($object, $description, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@ -213,18 +220,19 @@ abstract class AbstractDescriptorTest extends TestCase
|
|||||||
private function getContainerBuilderDescriptionTestData(array $objects)
|
private function getContainerBuilderDescriptionTestData(array $objects)
|
||||||
{
|
{
|
||||||
$variations = array(
|
$variations = array(
|
||||||
'services' => array('show_private' => true),
|
'services' => array('show_hidden' => true),
|
||||||
'public' => array('show_private' => false),
|
'public' => array('show_hidden' => false),
|
||||||
'tag1' => array('show_private' => true, 'tag' => 'tag1'),
|
'tag1' => array('show_hidden' => true, 'tag' => 'tag1'),
|
||||||
'tags' => array('group_by' => 'tags', 'show_private' => true),
|
'tags' => array('group_by' => 'tags', 'show_hidden' => true),
|
||||||
'arguments' => array('show_private' => false, 'show_arguments' => true),
|
'arguments' => array('show_hidden' => false, 'show_arguments' => true),
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($objects as $name => $object) {
|
foreach ($objects as $name => $object) {
|
||||||
foreach ($variations as $suffix => $options) {
|
foreach ($variations as $suffix => $options) {
|
||||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
|
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
|
||||||
$data[] = array($object, $description, $options);
|
$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();
|
$data = array();
|
||||||
foreach ($objects as $name => $object) {
|
foreach ($objects as $name => $object) {
|
||||||
foreach ($variations as $suffix => $options) {
|
foreach ($variations as $suffix => $options) {
|
||||||
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
|
$file = sprintf('%s_%s.%s', trim($name, '.'), $suffix, $this->getFormat());
|
||||||
$data[] = array($object, $description, $options);
|
$description = file_get_contents(__DIR__.'/../../Fixtures/Descriptor/'.$file);
|
||||||
|
$data[] = array($object, $description, $options, $file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,20 +107,20 @@ class ObjectsProvider
|
|||||||
->setSynthetic(false)
|
->setSynthetic(false)
|
||||||
->setLazy(true)
|
->setLazy(true)
|
||||||
->setAbstract(true)
|
->setAbstract(true)
|
||||||
->addArgument(new Reference('definition2'))
|
->addArgument(new Reference('.definition_2'))
|
||||||
->addArgument('%parameter%')
|
->addArgument('%parameter%')
|
||||||
->addArgument(new Definition('inline_service', array('arg1', 'arg2')))
|
->addArgument(new Definition('inline_service', array('arg1', 'arg2')))
|
||||||
->addArgument(array(
|
->addArgument(array(
|
||||||
'foo',
|
'foo',
|
||||||
new Reference('definition2'),
|
new Reference('.definition_2'),
|
||||||
new Definition('inline_service'),
|
new Definition('inline_service'),
|
||||||
))
|
))
|
||||||
->addArgument(new IteratorArgument(array(
|
->addArgument(new IteratorArgument(array(
|
||||||
new Reference('definition_1'),
|
new Reference('definition_1'),
|
||||||
new Reference('definition_2'),
|
new Reference('.definition_2'),
|
||||||
)))
|
)))
|
||||||
->setFactory(array('Full\\Qualified\\FactoryClass', 'get')),
|
->setFactory(array('Full\\Qualified\\FactoryClass', 'get')),
|
||||||
'definition_2' => $definition2
|
'.definition_2' => $definition2
|
||||||
->setPublic(false)
|
->setPublic(false)
|
||||||
->setSynthetic(true)
|
->setSynthetic(true)
|
||||||
->setFile('/path/to/file')
|
->setFile('/path/to/file')
|
||||||
@ -138,7 +138,7 @@ class ObjectsProvider
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'alias_1' => new Alias('service_1', true),
|
'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');
|
$container = $this->createContainerFromFile('cache');
|
||||||
|
|
||||||
$redisUrl = 'redis://localhost';
|
$redisUrl = 'redis://localhost';
|
||||||
$providerId = 'cache_connection.'.ContainerBuilder::hash($redisUrl);
|
$providerId = '.cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||||
|
|
||||||
$this->assertTrue($container->hasDefinition($providerId));
|
$this->assertTrue($container->hasDefinition($providerId));
|
||||||
|
|
||||||
@ -1142,7 +1142,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$container = $this->createContainerFromFile('cache_env_var');
|
$container = $this->createContainerFromFile('cache_env_var');
|
||||||
|
|
||||||
$redisUrl = 'redis://paas.com';
|
$redisUrl = 'redis://paas.com';
|
||||||
$providerId = 'cache_connection.'.ContainerBuilder::hash($redisUrl);
|
$providerId = '.cache_connection.'.ContainerBuilder::hash($redisUrl);
|
||||||
|
|
||||||
$this->assertTrue($container->hasDefinition($providerId));
|
$this->assertTrue($container->hasDefinition($providerId));
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"service": "service_2",
|
"service": ".service_2",
|
||||||
"public": false
|
"public": false
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
- Service: `service_2`
|
- Service: `.service_2`
|
||||||
- Public: no
|
- 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"?>
|
<?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
|
"public": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
### alias_2
|
### .alias_2
|
||||||
|
|
||||||
- Service: `service_2`
|
- Service: `.service_2`
|
||||||
- Public: no
|
- Public: no
|
||||||
|
|
||||||
### service_2
|
### .service_2
|
||||||
|
|
||||||
- Class: `Full\Qualified\Class2`
|
- Class: `Full\Qualified\Class2`
|
||||||
- Public: no
|
- 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
|
[33mInformation for Service "[39m[32m.service_2[39m[33m"[39m
|
||||||
[33m===================================[39m
|
[33m====================================[39m
|
||||||
|
|
||||||
----------------- ---------------------------------
|
----------------- ---------------------------------
|
||||||
[32m Option [39m [32m Value [39m
|
[32m Option [39m [32m Value [39m
|
||||||
----------------- ---------------------------------
|
----------------- ---------------------------------
|
||||||
Service ID service_2
|
Service ID .service_2
|
||||||
Class Full\Qualified\Class2
|
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 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
|
[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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<alias id="alias_2" service="service_2" public="false"/>
|
<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">
|
<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"/>
|
<factory service="factory.service" method="get"/>
|
||||||
<calls>
|
<calls>
|
||||||
<call method="setMailer"/>
|
<call method="setMailer"/>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition2"
|
"id": ".definition_2"
|
||||||
},
|
},
|
||||||
"%parameter%",
|
"%parameter%",
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"foo",
|
"foo",
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition2"
|
"id": ".definition_2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"class": "inline_service",
|
"class": "inline_service",
|
||||||
@ -58,7 +58,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition_2"
|
"id": ".definition_2"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@ -66,6 +66,19 @@
|
|||||||
"factory_class": "Full\\Qualified\\FactoryClass",
|
"factory_class": "Full\\Qualified\\FactoryClass",
|
||||||
"factory_method": "get",
|
"factory_method": "get",
|
||||||
"tags": []
|
"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": {
|
"aliases": {
|
||||||
@ -74,7 +87,5 @@
|
|||||||
"public": true
|
"public": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": {
|
"services": []
|
||||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Public services
|
Services
|
||||||
===============
|
========
|
||||||
|
|
||||||
Definitions
|
Definitions
|
||||||
-----------
|
-----------
|
||||||
@ -18,6 +18,18 @@ Definitions
|
|||||||
- Factory Class: `Full\Qualified\FactoryClass`
|
- Factory Class: `Full\Qualified\FactoryClass`
|
||||||
- Factory Method: `get`
|
- 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
|
Aliases
|
||||||
-------
|
-------
|
||||||
@ -27,8 +39,3 @@ Aliases
|
|||||||
- Service: `service_1`
|
- Service: `service_1`
|
||||||
- Public: yes
|
- Public: yes
|
||||||
|
|
||||||
|
|
||||||
Services
|
|
||||||
--------
|
|
||||||
|
|
||||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
[33mSymfony Container Public Services[39m
|
[33mSymfony Container Services[39m
|
||||||
[33m=================================[39m
|
[33m==========================[39m
|
||||||
|
|
||||||
------------------- --------------------------------------------------------
|
------------------- ----------------------------------------------------------
|
||||||
[32m Service ID [39m [32m Class name [39m
|
[32m Service ID [39m [32m Class name [39m
|
||||||
------------------- --------------------------------------------------------
|
------------------- ----------------------------------------------------------
|
||||||
alias_1 alias for "service_1"
|
alias_1 alias for "service_1"
|
||||||
definition_1 Full\Qualified\Class1
|
definition_1 Full\Qualified\Class1
|
||||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
service_container Symfony\Component\DependencyInjection\ContainerInterface
|
||||||
------------------- --------------------------------------------------------
|
------------------- ----------------------------------------------------------
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<alias id="alias_1" service="service_1" public="true"/>
|
<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="">
|
<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"/>
|
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||||
<argument type="service" id="definition2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
<argument>%parameter%</argument>
|
<argument>%parameter%</argument>
|
||||||
<argument>
|
<argument>
|
||||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
|
<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>
|
||||||
<argument type="collection">
|
<argument type="collection">
|
||||||
<argument>foo</argument>
|
<argument>foo</argument>
|
||||||
<argument type="service" id="definition2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
<argument>
|
<argument>
|
||||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||||
</argument>
|
</argument>
|
||||||
</argument>
|
</argument>
|
||||||
<argument type="iterator">
|
<argument type="iterator">
|
||||||
<argument type="service" id="definition_1"/>
|
<argument type="service" id="definition_1"/>
|
||||||
<argument type="service" id="definition_2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
</argument>
|
</argument>
|
||||||
</definition>
|
</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>
|
</container>
|
||||||
|
@ -13,6 +13,18 @@
|
|||||||
"factory_class": "Full\\Qualified\\FactoryClass",
|
"factory_class": "Full\\Qualified\\FactoryClass",
|
||||||
"factory_method": "get",
|
"factory_method": "get",
|
||||||
"tags": []
|
"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": {
|
"aliases": {
|
||||||
@ -21,7 +33,5 @@
|
|||||||
"public": true
|
"public": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": {
|
"services": []
|
||||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Public services
|
Services
|
||||||
===============
|
========
|
||||||
|
|
||||||
Definitions
|
Definitions
|
||||||
-----------
|
-----------
|
||||||
@ -17,6 +17,17 @@ Definitions
|
|||||||
- Factory Class: `Full\Qualified\FactoryClass`
|
- Factory Class: `Full\Qualified\FactoryClass`
|
||||||
- Factory Method: `get`
|
- 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
|
Aliases
|
||||||
-------
|
-------
|
||||||
@ -26,8 +37,3 @@ Aliases
|
|||||||
- Service: `service_1`
|
- Service: `service_1`
|
||||||
- Public: yes
|
- Public: yes
|
||||||
|
|
||||||
|
|
||||||
Services
|
|
||||||
--------
|
|
||||||
|
|
||||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
[33mSymfony Container Public Services[39m
|
[33mSymfony Container Services[39m
|
||||||
[33m=================================[39m
|
[33m==========================[39m
|
||||||
|
|
||||||
------------------- --------------------------------------------------------
|
------------------- ----------------------------------------------------------
|
||||||
[32m Service ID [39m [32m Class name [39m
|
[32m Service ID [39m [32m Class name [39m
|
||||||
------------------- --------------------------------------------------------
|
------------------- ----------------------------------------------------------
|
||||||
alias_1 alias for "service_1"
|
alias_1 alias for "service_1"
|
||||||
definition_1 Full\Qualified\Class1
|
definition_1 Full\Qualified\Class1
|
||||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
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="">
|
<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"/>
|
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||||
</definition>
|
</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>
|
</container>
|
||||||
|
@ -1,20 +1,6 @@
|
|||||||
{
|
{
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"definition_1": {
|
".definition_2": {
|
||||||
"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": {
|
|
||||||
"class": "Full\\Qualified\\Class2",
|
"class": "Full\\Qualified\\Class2",
|
||||||
"public": false,
|
"public": false,
|
||||||
"synthetic": true,
|
"synthetic": true,
|
||||||
@ -51,16 +37,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"alias_1": {
|
".alias_2": {
|
||||||
"service": "service_1",
|
"service": ".service_2",
|
||||||
"public": true
|
|
||||||
},
|
|
||||||
"alias_2": {
|
|
||||||
"service": "service_2",
|
|
||||||
"public": false
|
"public": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": {
|
"services": []
|
||||||
"service_container": "Symfony\\Component\\DependencyInjection\\ContainerBuilder"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,10 @@
|
|||||||
Public and private services
|
Hidden services
|
||||||
===========================
|
===============
|
||||||
|
|
||||||
Definitions
|
Definitions
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
### definition_1
|
### .definition_2
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- Class: `Full\Qualified\Class2`
|
- Class: `Full\Qualified\Class2`
|
||||||
- Public: no
|
- Public: no
|
||||||
@ -42,18 +29,8 @@ Definitions
|
|||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
|
|
||||||
### alias_1
|
### .alias_2
|
||||||
|
|
||||||
- Service: `service_1`
|
- Service: `.service_2`
|
||||||
- Public: yes
|
|
||||||
|
|
||||||
### alias_2
|
|
||||||
|
|
||||||
- Service: `service_2`
|
|
||||||
- Public: no
|
- Public: no
|
||||||
|
|
||||||
|
|
||||||
Services
|
|
||||||
--------
|
|
||||||
|
|
||||||
- `service_container`: `Symfony\Component\DependencyInjection\ContainerBuilder`
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
|
|
||||||
[33mSymfony Container Public and Private Services[39m
|
[33mSymfony Container Hidden Services[39m
|
||||||
[33m=============================================[39m
|
[33m=================================[39m
|
||||||
|
|
||||||
------------------- --------------------------------------------------------
|
--------------- ------------------------
|
||||||
[32m Service ID [39m [32m Class name [39m
|
[32m Service ID [39m [32m Class name [39m
|
||||||
------------------- --------------------------------------------------------
|
--------------- ------------------------
|
||||||
alias_1 alias for "service_1"
|
.alias_2 alias for ".service_2"
|
||||||
alias_2 alias for "service_2"
|
.definition_2 Full\Qualified\Class2
|
||||||
definition_1 Full\Qualified\Class1
|
--------------- ------------------------
|
||||||
definition_2 Full\Qualified\Class2
|
|
||||||
service_container Symfony\Component\DependencyInjection\ContainerBuilder
|
|
||||||
------------------- --------------------------------------------------------
|
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<container>
|
<container>
|
||||||
<alias id="alias_1" service="service_1" public="true"/>
|
<alias id=".alias_2" service=".service_2" public="false"/>
|
||||||
<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">
|
||||||
<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">
|
|
||||||
<factory service="factory.service" method="get"/>
|
<factory service="factory.service" method="get"/>
|
||||||
<calls>
|
<calls>
|
||||||
<call method="setMailer"/>
|
<call method="setMailer"/>
|
||||||
@ -21,5 +17,4 @@
|
|||||||
<tag name="tag2"/>
|
<tag name="tag2"/>
|
||||||
</tags>
|
</tags>
|
||||||
</definition>
|
</definition>
|
||||||
<service id="service_container" class="Symfony\Component\DependencyInjection\ContainerBuilder"/>
|
|
||||||
</container>
|
</container>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"definition_2": {
|
".definition_2": {
|
||||||
"class": "Full\\Qualified\\Class2",
|
"class": "Full\\Qualified\\Class2",
|
||||||
"public": false,
|
"public": false,
|
||||||
"synthetic": true,
|
"synthetic": true,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
Public and private services with tag `tag1`
|
Hidden services with tag `tag1`
|
||||||
===========================================
|
===============================
|
||||||
|
|
||||||
Definitions
|
Definitions
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
### definition_2
|
### .definition_2
|
||||||
|
|
||||||
- Class: `Full\Qualified\Class2`
|
- Class: `Full\Qualified\Class2`
|
||||||
- Public: no
|
- Public: no
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
[33mSymfony Container Public and Private Services Tagged with "tag1" Tag[39m
|
[33mSymfony Container Hidden Services Tagged with "tag1" Tag[39m
|
||||||
[33m====================================================================[39m
|
[33m========================================================[39m
|
||||||
|
|
||||||
-------------- ------- ------- ------- -----------------------
|
--------------- ------- ------- ------- -----------------------
|
||||||
[32m Service ID [39m [32m attr1 [39m [32m attr2 [39m [32m attr3 [39m [32m Class name [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
|
.definition_2 val1 val2 Full\Qualified\Class2
|
||||||
" val3
|
" val3
|
||||||
-------------- ------- ------- ------- -----------------------
|
--------------- ------- ------- ------- -----------------------
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<container>
|
<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"/>
|
<factory service="factory.service" method="get"/>
|
||||||
<calls>
|
<calls>
|
||||||
<call method="setMailer"/>
|
<call method="setMailer"/>
|
||||||
|
@ -4,7 +4,7 @@ Container tags
|
|||||||
tag1
|
tag1
|
||||||
----
|
----
|
||||||
|
|
||||||
### definition_2
|
### .definition_2
|
||||||
|
|
||||||
- Class: `Full\Qualified\Class2`
|
- Class: `Full\Qualified\Class2`
|
||||||
- Public: no
|
- Public: no
|
||||||
@ -23,7 +23,7 @@ tag1
|
|||||||
tag2
|
tag2
|
||||||
----
|
----
|
||||||
|
|
||||||
### definition_2
|
### .definition_2
|
||||||
|
|
||||||
- Class: `Full\Qualified\Class2`
|
- Class: `Full\Qualified\Class2`
|
||||||
- Public: no
|
- Public: no
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
[33mSymfony Container Public and Private Tags[39m
|
[33mSymfony Container Hidden Tags[39m
|
||||||
[33m=========================================[39m
|
[33m=============================[39m
|
||||||
|
|
||||||
[33m"tag1" tag[39m
|
[33m"tag1" tag[39m
|
||||||
[33m----------[39m
|
[33m----------[39m
|
||||||
|
|
||||||
* definition_2
|
* .definition_2
|
||||||
|
|
||||||
[33m"tag2" tag[39m
|
[33m"tag2" tag[39m
|
||||||
[33m----------[39m
|
[33m----------[39m
|
||||||
|
|
||||||
* definition_2
|
* .definition_2
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<container>
|
<container>
|
||||||
<tag name="tag1">
|
<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"/>
|
<factory service="factory.service" method="get"/>
|
||||||
<calls>
|
<calls>
|
||||||
<call method="setMailer"/>
|
<call method="setMailer"/>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
</definition>
|
</definition>
|
||||||
</tag>
|
</tag>
|
||||||
<tag name="tag2">
|
<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"/>
|
<factory service="factory.service" method="get"/>
|
||||||
<calls>
|
<calls>
|
||||||
<call method="setMailer"/>
|
<call method="setMailer"/>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"arguments": [
|
"arguments": [
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition2"
|
"id": ".definition_2"
|
||||||
},
|
},
|
||||||
"%parameter%",
|
"%parameter%",
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@
|
|||||||
"foo",
|
"foo",
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition2"
|
"id": ".definition_2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"class": "inline_service",
|
"class": "inline_service",
|
||||||
@ -56,7 +56,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "service",
|
"type": "service",
|
||||||
"id": "definition_2"
|
"id": ".definition_2"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
Autoconfigured no
|
Autoconfigured no
|
||||||
Factory Class Full\Qualified\FactoryClass
|
Factory Class Full\Qualified\FactoryClass
|
||||||
Factory Method get
|
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;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;49mInlined Service[39;49m[39;49m [39;49m
|
||||||
[39;49m [39;49m[39;49mArray (3 element(s))[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"?>
|
<?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="">
|
<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"/>
|
<factory class="Full\Qualified\FactoryClass" method="get"/>
|
||||||
<argument type="service" id="definition2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
<argument>%parameter%</argument>
|
<argument>%parameter%</argument>
|
||||||
<argument>
|
<argument>
|
||||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file="">
|
<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>
|
||||||
<argument type="collection">
|
<argument type="collection">
|
||||||
<argument>foo</argument>
|
<argument>foo</argument>
|
||||||
<argument type="service" id="definition2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
<argument>
|
<argument>
|
||||||
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
<definition class="inline_service" public="false" synthetic="false" lazy="false" shared="true" abstract="false" autowired="false" autoconfigured="false" file=""/>
|
||||||
</argument>
|
</argument>
|
||||||
</argument>
|
</argument>
|
||||||
<argument type="iterator">
|
<argument type="iterator">
|
||||||
<argument type="service" id="definition_1"/>
|
<argument type="service" id="definition_1"/>
|
||||||
<argument type="service" id="definition_2"/>
|
<argument type="service" id=".definition_2"/>
|
||||||
</argument>
|
</argument>
|
||||||
</definition>
|
</definition>
|
||||||
|
@ -16,4 +16,4 @@
|
|||||||
- Attr2: val2
|
- Attr2: val2
|
||||||
- Tag: `tag1`
|
- Tag: `tag1`
|
||||||
- Attr3: val3
|
- Attr3: val3
|
||||||
- Tag: `tag2`
|
- Tag: `tag2`
|
||||||
|
@ -55,12 +55,12 @@ class ContainerDebugCommandTest extends WebTestCase
|
|||||||
$application->setAutoExit(false);
|
$application->setAutoExit(false);
|
||||||
|
|
||||||
$tester = new ApplicationTester($application);
|
$tester = new ApplicationTester($application);
|
||||||
$tester->run(array('command' => 'debug:container', '--show-private' => true));
|
$tester->run(array('command' => 'debug:container', '--show-hidden' => true));
|
||||||
$this->assertContains('public', $tester->getDisplay());
|
$this->assertNotContains('public', $tester->getDisplay());
|
||||||
$this->assertContains('private_alias', $tester->getDisplay());
|
$this->assertNotContains('private_alias', $tester->getDisplay());
|
||||||
|
|
||||||
$tester->run(array('command' => 'debug:container'));
|
$tester->run(array('command' => 'debug:container'));
|
||||||
$this->assertContains('public', $tester->getDisplay());
|
$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)
|
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];
|
return $this->expressions[$id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ class SecurityExtension extends Extension
|
|||||||
$methods = array_map('strtoupper', (array) $methods);
|
$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])) {
|
if (isset($this->requestMatchers[$id])) {
|
||||||
return $this->requestMatchers[$id];
|
return $this->requestMatchers[$id];
|
||||||
|
@ -84,7 +84,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'simple',
|
'simple',
|
||||||
'security.user_checker',
|
'security.user_checker',
|
||||||
'security.request_matcher.6tndozi',
|
'.security.request_matcher.6tndozi',
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
@ -117,7 +117,7 @@ abstract class CompleteConfigurationTest extends TestCase
|
|||||||
array(
|
array(
|
||||||
'host',
|
'host',
|
||||||
'security.user_checker',
|
'security.user_checker',
|
||||||
'security.request_matcher.and0kk1',
|
'.security.request_matcher.and0kk1',
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
'security.user.provider.concrete.default',
|
'security.user.provider.concrete.default',
|
||||||
|
@ -90,7 +90,7 @@ class AutowirePass extends AbstractRecursivePass
|
|||||||
|
|
||||||
if (ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
|
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
|
// 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);
|
->addError($message);
|
||||||
|
|
||||||
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
||||||
|
@ -75,8 +75,8 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
|||||||
foreach ($instanceofDefs as $key => $instanceofDef) {
|
foreach ($instanceofDefs as $key => $instanceofDef) {
|
||||||
/** @var ChildDefinition $instanceofDef */
|
/** @var ChildDefinition $instanceofDef */
|
||||||
$instanceofDef = clone $instanceofDef;
|
$instanceofDef = clone $instanceofDef;
|
||||||
$instanceofDef->setAbstract(true)->setParent($parent ?: 'abstract.instanceof.'.$id);
|
$instanceofDef->setAbstract(true)->setParent($parent ?: '.abstract.instanceof.'.$id);
|
||||||
$parent = 'instanceof.'.$interface.'.'.$key.'.'.$id;
|
$parent = '.instanceof.'.$interface.'.'.$key.'.'.$id;
|
||||||
$container->setDefinition($parent, $instanceofDef);
|
$container->setDefinition($parent, $instanceofDef);
|
||||||
$instanceofTags[] = $instanceofDef->getTags();
|
$instanceofTags[] = $instanceofDef->getTags();
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
|
|||||||
|
|
||||||
if ($parent) {
|
if ($parent) {
|
||||||
$bindings = $definition->getBindings();
|
$bindings = $definition->getBindings();
|
||||||
$abstract = $container->setDefinition('abstract.instanceof.'.$id, $definition);
|
$abstract = $container->setDefinition('.abstract.instanceof.'.$id, $definition);
|
||||||
|
|
||||||
// cast Definition to ChildDefinition
|
// cast Definition to ChildDefinition
|
||||||
$definition->setBindings(array());
|
$definition->setBindings(array());
|
||||||
|
@ -105,7 +105,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
|
|||||||
$e = new ServiceNotFoundException($id, $this->currentId);
|
$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
|
// 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());
|
->addError($e->getMessage());
|
||||||
|
|
||||||
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
|
||||||
|
@ -54,7 +54,7 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass
|
|||||||
|
|
||||||
$value->setArguments($arguments);
|
$value->setArguments($arguments);
|
||||||
|
|
||||||
$id = 'service_locator.'.ContainerBuilder::hash($value);
|
$id = '.service_locator.'.ContainerBuilder::hash($value);
|
||||||
|
|
||||||
if ($isRoot) {
|
if ($isRoot) {
|
||||||
if ($id !== $this->currentId) {
|
if ($id !== $this->currentId) {
|
||||||
@ -91,7 +91,7 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass
|
|||||||
->setPublic(false)
|
->setPublic(false)
|
||||||
->addTag('container.service_locator');
|
->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);
|
$container->setDefinition($id, $locator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +262,9 @@ class Container implements ResettableContainerInterface
|
|||||||
|
|
||||||
$alternatives = array();
|
$alternatives = array();
|
||||||
foreach ($this->getServiceIds() as $knownId) {
|
foreach ($this->getServiceIds() as $knownId) {
|
||||||
|
if ('' === $knownId || '.' === $knownId[0]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$lev = levenshtein($id, $knownId);
|
$lev = levenshtein($id, $knownId);
|
||||||
if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
|
if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
|
||||||
$alternatives[] = $knownId;
|
$alternatives[] = $knownId;
|
||||||
|
@ -79,7 +79,7 @@ class ServicesConfigurator extends AbstractConfigurator
|
|||||||
throw new \LogicException('Anonymous services must have a class name.');
|
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);
|
$definition->setPublic(false);
|
||||||
} else {
|
} else {
|
||||||
$definition->setPublic($defaults->isPublic());
|
$definition->setPublic($defaults->isPublic());
|
||||||
|
@ -409,7 +409,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
if ($services = $this->getChildren($node, 'service')) {
|
if ($services = $this->getChildren($node, 'service')) {
|
||||||
// give it a unique name
|
// 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('id', $id);
|
||||||
$node->setAttribute('service', $id);
|
$node->setAttribute('service', $id);
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
$instanceof = $this->instanceof;
|
$instanceof = $this->instanceof;
|
||||||
$this->instanceof = array();
|
$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());
|
$this->parseDefinition($id, $argument, $file, array());
|
||||||
|
|
||||||
if (!$this->container->hasDefinition($id)) {
|
if (!$this->container->hasDefinition($id)) {
|
||||||
|
@ -882,6 +882,6 @@ class AutowirePassTest extends TestCase
|
|||||||
|
|
||||||
$erroredDefinition = new Definition(MissingClass::class);
|
$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);
|
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||||
|
|
||||||
$parent = 'instanceof.'.parent::class.'.0.foo';
|
$parent = '.instanceof.'.parent::class.'.0.foo';
|
||||||
$def = $container->getDefinition('foo');
|
$def = $container->getDefinition('foo');
|
||||||
$this->assertEmpty($def->getInstanceofConditionals());
|
$this->assertEmpty($def->getInstanceofConditionals());
|
||||||
$this->assertInstanceOf(ChildDefinition::class, $def);
|
$this->assertInstanceOf(ChildDefinition::class, $def);
|
||||||
@ -260,7 +260,7 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
|
|||||||
|
|
||||||
(new ResolveInstanceofConditionalsPass())->process($container);
|
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||||
|
|
||||||
$abstract = $container->getDefinition('abstract.instanceof.bar');
|
$abstract = $container->getDefinition('.abstract.instanceof.bar');
|
||||||
|
|
||||||
$this->assertEmpty($abstract->getArguments());
|
$this->assertEmpty($abstract->getArguments());
|
||||||
$this->assertEmpty($abstract->getMethodCalls());
|
$this->assertEmpty($abstract->getMethodCalls());
|
||||||
|
@ -8,7 +8,7 @@ services:
|
|||||||
class: Bar\FooClass
|
class: Bar\FooClass
|
||||||
public: true
|
public: true
|
||||||
arguments: [!tagged listener]
|
arguments: [!tagged listener]
|
||||||
2_stdClass~%s:
|
.2_stdClass~%s:
|
||||||
class: stdClass
|
class: stdClass
|
||||||
public: false
|
public: false
|
||||||
tags:
|
tags:
|
||||||
|
@ -54,11 +54,11 @@ class ProjectServiceContainer extends Container
|
|||||||
public function getRemovedIds()
|
public function getRemovedIds()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
'.service_locator.ljJrY4L' => true,
|
||||||
|
'.service_locator.ljJrY4L.foo_service' => true,
|
||||||
'Psr\\Container\\ContainerInterface' => true,
|
'Psr\\Container\\ContainerInterface' => true,
|
||||||
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true,
|
||||||
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 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->assertCount(1, $args);
|
||||||
$this->assertInstanceOf(Reference::class, $args[0]);
|
$this->assertInstanceOf(Reference::class, $args[0]);
|
||||||
$this->assertTrue($container->has((string) $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]);
|
$anonymous = $container->getDefinition((string) $args[0]);
|
||||||
$this->assertEquals('Bar', $anonymous->getClass());
|
$this->assertEquals('Bar', $anonymous->getClass());
|
||||||
@ -567,7 +567,7 @@ class YamlFileLoaderTest extends TestCase
|
|||||||
$this->assertInternalType('array', $factory);
|
$this->assertInternalType('array', $factory);
|
||||||
$this->assertInstanceOf(Reference::class, $factory[0]);
|
$this->assertInstanceOf(Reference::class, $factory[0]);
|
||||||
$this->assertTrue($container->has((string) $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]);
|
$this->assertEquals('constructFoo', $factory[1]);
|
||||||
|
|
||||||
$anonymous = $container->getDefinition((string) $factory[0]);
|
$anonymous = $container->getDefinition((string) $factory[0]);
|
||||||
|
@ -139,7 +139,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
|
|||||||
$binding->setValues(array($bindingValue, $bindingId, true));
|
$binding->setValues(array($bindingValue, $bindingId, true));
|
||||||
|
|
||||||
if (!$bindingValue instanceof Reference) {
|
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')
|
$container->register((string) $args[$p->name], 'mixed')
|
||||||
->setFactory('current')
|
->setFactory('current')
|
||||||
->addArgument(array($bindingValue));
|
->addArgument(array($bindingValue));
|
||||||
|
Reference in New Issue
Block a user