Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c27c7fc

Browse filesBrowse files
committed
Add warning on service definition if the service was excluded.
1 parent f523cea commit c27c7fc
Copy full SHA for c27c7fc

File tree

1 file changed

+10
-5
lines changed
Filter options

1 file changed

+10
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
161161

162162
try {
163163
$helper->describe($io, $object, $options);
164+
$definition = $object->hasDefinition($options["id"])
165+
? $object->getDefinition($options["id"])
166+
: null;
164167

165168
if ('txt' === $options['format'] && isset($options['id'])) {
166-
if ($object->hasDefinition($options['id'])) {
167-
$definition = $object->getDefinition($options['id']);
168-
if ($definition->isDeprecated()) {
169-
$errorIo->warning($definition->getDeprecation($options['id'])['message'] ?? sprintf('The "%s" service is deprecated.', $options['id']));
170-
}
169+
if (null !== $definition && $definition->isDeprecated()) {
170+
$errorIo->warning($definition->getDeprecation($options['id'])['message'] ?? sprintf('The "%s" service is deprecated.', $options['id']));
171171
}
172172
if ($object->hasAlias($options['id'])) {
173173
$alias = $object->getAlias($options['id']);
@@ -177,6 +177,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
177177
}
178178
}
179179

180+
if (null !== $definition && $definition->hasTag("container.excluded"))
181+
{
182+
$errorIo->warning(\sprintf('The "%s" service is excluded from the service container.', $definition->getClass()));
183+
}
184+
180185
if (isset($options['id']) && isset($kernel->getContainer()->getRemovedIds()[$options['id']])) {
181186
$errorIo->note(sprintf('The "%s" service or alias has been removed or inlined when the container was compiled.', $options['id']));
182187
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.