Skip to content

Commit

Permalink
bug #25996 Don't show wanna-be-private services as public in debug:co…
Browse files Browse the repository at this point in the history
…ntainer (chalasr)

This PR was merged into the 3.4 branch.

Discussion
----------

Don't show wanna-be-private services as public in debug:container

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25987
| License       | MIT
| Doc PR        | n/a

Commits
-------

31f43e5 Don't show wanna-be-private services as public in debug:container
  • Loading branch information
fabpot committed Feb 1, 2018
2 parents f284004 + 31f43e5 commit 1461524
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
Expand Up @@ -113,11 +113,11 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$service = $this->resolveServiceDefinition($builder, $serviceId);

if ($service instanceof Alias) {
if ($showPrivate || $service->isPublic()) {
if ($showPrivate || ($service->isPublic() && !$service->isPrivate())) {
$data['aliases'][$serviceId] = $this->getContainerAliasData($service);
}
} elseif ($service instanceof Definition) {
if (($showPrivate || $service->isPublic())) {
if (($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments);
}
} else {
Expand Down Expand Up @@ -217,7 +217,7 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
{
$data = array(
'class' => (string) $definition->getClass(),
'public' => $definition->isPublic(),
'public' => $definition->isPublic() && !$definition->isPrivate(),
'synthetic' => $definition->isSynthetic(),
'lazy' => $definition->isLazy(),
'shared' => $definition->isShared(),
Expand Down Expand Up @@ -281,7 +281,7 @@ private function getContainerAliasData(Alias $alias)
{
return array(
'service' => (string) $alias,
'public' => $alias->isPublic(),
'public' => $alias->isPublic() && !$alias->isPrivate(),
);
}

Expand Down
Expand Up @@ -139,11 +139,11 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$service = $this->resolveServiceDefinition($builder, $serviceId);

if ($service instanceof Alias) {
if ($showPrivate || $service->isPublic()) {
if ($showPrivate || ($service->isPublic() && !$service->isPrivate())) {
$services['aliases'][$serviceId] = $service;
}
} elseif ($service instanceof Definition) {
if (($showPrivate || $service->isPublic())) {
if (($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
$services['definitions'][$serviceId] = $service;
}
} else {
Expand Down Expand Up @@ -182,7 +182,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
protected function describeContainerDefinition(Definition $definition, array $options = array())
{
$output = '- Class: `'.$definition->getClass().'`'
."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
."\n".'- Public: '.($definition->isPublic() && !$definition->isPrivate() ? 'yes' : 'no')
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
."\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no')
Expand Down Expand Up @@ -246,7 +246,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
protected function describeContainerAlias(Alias $alias, array $options = array(), ContainerBuilder $builder = null)
{
$output = '- Service: `'.$alias.'`'
."\n".'- Public: '.($alias->isPublic() ? 'yes' : 'no');
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');

if (!isset($options['id'])) {
return $this->write($output);
Expand Down
Expand Up @@ -194,7 +194,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$definition = $this->resolveServiceDefinition($builder, $serviceId);
if ($definition instanceof Definition) {
// filter out private services unless shown explicitly
if (!$showPrivate && !$definition->isPublic()) {
if (!$showPrivate && (!$definition->isPublic() || $definition->isPrivate())) {
unset($serviceIds[$key]);
continue;
}
Expand All @@ -212,7 +212,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
}
}
} elseif ($definition instanceof Alias) {
if (!$showPrivate && !$definition->isPublic()) {
if (!$showPrivate && (!$definition->isPublic() || $definition->isPrivate())) {
unset($serviceIds[$key]);
continue;
}
Expand Down Expand Up @@ -302,7 +302,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$tableRows[] = array('Calls', implode(', ', $callInformation));
}

$tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no');
$tableRows[] = array('Public', $definition->isPublic() && !$definition->isPrivate() ? 'yes' : 'no');
$tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no');
$tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no');
$tableRows[] = array('Shared', $definition->isShared() ? 'yes' : 'no');
Expand Down
Expand Up @@ -318,7 +318,7 @@ private function getContainerServicesDocument(ContainerBuilder $builder, $tag =
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
$service = $this->resolveServiceDefinition($builder, $serviceId);

if (($service instanceof Definition || $service instanceof Alias) && !($showPrivate || $service->isPublic())) {
if (($service instanceof Definition || $service instanceof Alias) && !($showPrivate || ($service->isPublic() && !$service->isPrivate()))) {
continue;
}

Expand Down Expand Up @@ -364,7 +364,7 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu
}
}

$serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false');
$serviceXML->setAttribute('public', $definition->isPublic() && !$definition->isPrivate() ? 'true' : 'false');
$serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false');
$serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false');
$serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false');
Expand Down Expand Up @@ -469,7 +469,7 @@ private function getContainerAliasDocument(Alias $alias, $id = null)
}

$aliasXML->setAttribute('service', (string) $alias);
$aliasXML->setAttribute('public', $alias->isPublic() ? 'true' : 'false');
$aliasXML->setAttribute('public', $alias->isPublic() && !$alias->isPrivate() ? 'true' : 'false');

return $dom;
}
Expand Down
Expand Up @@ -17,7 +17,7 @@
"%parameter%",
{
"class": "inline_service",
"public": true,
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
Expand All @@ -39,7 +39,7 @@
},
{
"class": "inline_service",
"public": true,
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
Expand Down
Expand Up @@ -6,7 +6,7 @@
<argument type="service" id="definition2"/>
<argument>%parameter%</argument>
<argument>
<definition class="inline_service" public="true" 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>arg1</argument>
<argument>arg2</argument>
</definition>
Expand All @@ -15,7 +15,7 @@
<argument>foo</argument>
<argument type="service" id="definition2"/>
<argument>
<definition class="inline_service" public="true" 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 type="iterator">
Expand Down
Expand Up @@ -15,7 +15,7 @@
"%parameter%",
{
"class": "inline_service",
"public": true,
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
Expand All @@ -37,7 +37,7 @@
},
{
"class": "inline_service",
"public": true,
"public": false,
"synthetic": false,
"lazy": false,
"shared": true,
Expand Down
Expand Up @@ -4,7 +4,7 @@
<argument type="service" id="definition2"/>
<argument>%parameter%</argument>
<argument>
<definition class="inline_service" public="true" 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>arg1</argument>
<argument>arg2</argument>
</definition>
Expand All @@ -13,7 +13,7 @@
<argument>foo</argument>
<argument type="service" id="definition2"/>
<argument>
<definition class="inline_service" public="true" 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 type="iterator">
Expand Down

0 comments on commit 1461524

Please sign in to comment.