8000 Don't show wanna-be-private services as public in debug:container by chalasr · Pull Request #25996 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't show wanna-be-private services as public in debug:container
  • Loading branch information
Robin Chalas committed Jan 31, 2018
commit 31f43e52261c6a3310fdd803f83b87e98b689bf5
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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