Skip to content

Commit 3145062

Browse files
Merge branch '6.2' into 6.3
* 6.2: Fix Typos Ignore definitions bearing the `container.excluded` tag Bump Symfony version to 6.2.12 Update VERSION for 6.2.11 Update CHANGELOG for 6.2.11 Bump Symfony version to 5.4.25 Update CONTRIBUTORS for 5.4.24 Update VERSION for 5.4.24 Update CHANGELOG for 5.4.24
2 parents 6246abe + 93facff commit 3145062

File tree

7 files changed

+44
-0
lines changed

7 files changed

+44
-0
lines changed

Console/Descriptor/JsonDescriptor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ protected function describeContainerServices(ContainerBuilder $container, array
106106
if ($service instanceof Alias) {
107107
$data['aliases'][$serviceId] = $this->getContainerAliasData($service);
108108
} elseif ($service instanceof Definition) {
109+
if ($service->hasTag('container.excluded')) {
110+
continue;
111+
}
109112
$data['definitions'][$serviceId] = $this->getContainerDefinitionData($service, $omitTags, $showArguments, $container, $serviceId);
110113
} else {
111114
$data['services'][$serviceId] = $service::class;

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ protected function describeContainerServices(ContainerBuilder $container, array
162162
if ($service instanceof Alias) {
163163
$services['aliases'][$serviceId] = $service;
164164
} elseif ($service instanceof Definition) {
165+
if ($service->hasTag('container.excluded')) {
166+
continue;
167+
}
165168
$services['definitions'][$serviceId] = $service;
166169
} else {
167170
$services['services'][$serviceId] = $service;

Console/Descriptor/TextDescriptor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ protected function describeContainerServices(ContainerBuilder $container, array
198198
}
199199

200200
if ($definition instanceof Definition) {
201+
if ($definition->hasTag('container.excluded')) {
202+
unset($serviceIds[$key]);
203+
continue;
204+
}
201205
if ($showTag) {
202206
$tags = $definition->getTag($showTag);
203207
foreach ($tags as $tag) {

Console/Descriptor/XmlDescriptor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ private function getContainerServicesDocument(ContainerBuilder $container, strin
293293
continue;
294294
}
295295

296+
if ($service instanceof Definition) {
297+
if ($service->hasTag('container.excluded')) {
298+
continue;
299+
}
300+
}
301+
296302
$serviceXML = $this->getContainerServiceDocument($service, $serviceId, null, $showArguments);
297303
$containerXML->appendChild($containerXML->ownerDocument->importNode($serviceXML->childNodes->item(0), true));
298304
}

Tests/Fixtures/ContainerExcluded.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
6+
7+
/**
8+
* @author Maksim Vorozhtsov <[email protected]>
9+
*/
10+
class ContainerExcluded
11+
{
12+
}

Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Console\Application;
1515
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass;
16+
use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ContainerExcluded;
1617
use Symfony\Component\Console\Tester\ApplicationTester;
1718
use Symfony\Component\Console\Tester\CommandCompletionTester;
1819
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -99,6 +100,19 @@ public function testDeprecatedServiceAndAlias()
99100
$this->assertStringContainsString('[WARNING] The "deprecated_alias" alias is deprecated since foo/bar 1.9 and will be removed in 2.0', $tester->getDisplay());
100101
}
101102

103+
public function testExcludedService()
104+
{
105+
static::bootKernel(['test_case' => 'ContainerDebug', 'root_config' => 'config.yml']);
106+
107+
$application = new Application(static::$kernel);
108+
$application->setAutoExit(false);
109+
110+
$tester = new ApplicationTester($application);
111+
112+
$tester->run(['command' => 'debug:container']);
113+
$this->assertStringNotContainsString(ContainerExcluded::class, $tester->getDisplay());
114+
}
115+
102116
/**
103117
* @dataProvider provideIgnoreBackslashWhenFindingService
104118
*/

Tests/Functional/app/ContainerDebug/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ services:
3333
- '%env(REAL)%'
3434
- '%env(int:key:2:json:JSON)%'
3535
- '%env(float:key:2:json:JSON)%'
36+
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ContainerExcluded:
37+
tags: ['container.excluded']

0 commit comments

Comments
 (0)