Skip to content

Commit 8e84115

Browse files
Merge branch '4.1'
* 4.1: [Finder] fixed root directory access for ftp/sftp wrapper [Console] Fix clearing sections containing questions [FrameworkBundle] dont suggest hidden services in debug:container and debug:autow commands [FWBundle] Throw if PropertyInfo is enabled, but the component isn't installed Remove redundant path check
2 parents bbd02dc + 3a0f2ec commit 8e84115

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

Command/ContainerDebugCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
133133
} elseif ($tag = $input->getOption('tag')) {
134134
$options = array('tag' => $tag);
135135
} elseif ($name = $input->getArgument('name')) {
136-
$name = $this->findProperServiceName($input, $errorIo, $object, $name);
136+
$name = $this->findProperServiceName($input, $errorIo, $object, $name, $input->getOption('show-hidden'));
137137
$options = array('id' => $name);
138138
} else {
139139
$options = array();
@@ -218,13 +218,13 @@ protected function getContainerBuilder()
218218
return $this->containerBuilder = $container;
219219
}
220220

221-
private function findProperServiceName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $builder, $name)
221+
private function findProperServiceName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $builder, string $name, bool $showHidden)
222222
{
223223
if ($builder->has($name) || !$input->isInteractive()) {
224224
return $name;
225225
}
226226

227-
$matchingServices = $this->findServiceIdsContaining($builder, $name);
227+
$matchingServices = $this->findServiceIdsContaining($builder, $name, $showHidden);
228228
if (empty($matchingServices)) {
229229
throw new InvalidArgumentException(sprintf('No services found that match "%s".', $name));
230230
}
@@ -236,11 +236,14 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
236236
return $io->choice('Select one of the following services to display its information', $matchingServices);
237237
}
238238

239-
private function findServiceIdsContaining(ContainerBuilder $builder, $name)
239+
private function findServiceIdsContaining(ContainerBuilder $builder, string $name, bool $showHidden)
240240
{
241241
$serviceIds = $builder->getServiceIds();
242242
$foundServiceIds = $foundServiceIdsIgnoringBackslashes = array();
243243
foreach ($serviceIds as $serviceId) {
244+
if (!$showHidden && 0 === strpos($serviceId, '.')) {
245+
continue;
246+
}
244247
if (false !== stripos(str_replace('\\', '', $serviceId), $name)) {
245248
$foundServiceIdsIgnoringBackslashes[] = $serviceId;
246249
}

Command/DebugAutowiringCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6666

6767
if ($search = $input->getArgument('search')) {
6868
$serviceIds = array_filter($serviceIds, function ($serviceId) use ($search) {
69-
return false !== stripos(str_replace('\\', '', $serviceId), $search);
69+
return false !== stripos(str_replace('\\', '', $serviceId), $search) && 0 !== strpos($serviceId, '.');
7070
});
7171

7272
if (empty($serviceIds)) {

DependencyInjection/FrameworkExtension.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
7676
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
7777
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
78+
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
7879
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
7980
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
8081
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
@@ -272,7 +273,7 @@ public function load(array $configs, ContainerBuilder $container)
272273
}
273274

274275
if ($this->isConfigEnabled($container, $config['property_info'])) {
275-
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader);
276+
$this->registerPropertyInfoConfiguration($container, $loader);
276277
}
277278

278279
if ($this->isConfigEnabled($container, $config['lock'])) {
@@ -1374,8 +1375,12 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
13741375
}
13751376
}
13761377

1377-
private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
1378+
private function registerPropertyInfoConfiguration(ContainerBuilder $container, XmlFileLoader $loader)
13781379
{
1380+
if (!interface_exists(PropertyInfoExtractorInterface::class)) {
1381+
throw new LogicException('PropertyInfo support cannot be enabled as the PropertyInfo component is not installed. Try running "composer require symfony/property-info".');
1382+
}
1383+
13791384
$loader->load('property_info.xml');
13801385

13811386
if (interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) {

0 commit comments

Comments
 (0)