Skip to content

Commit 3fd5aec

Browse files
Merge branch '4.4' into 5.0
* 4.4: updated VERSION for 3.4.40 update CONTRIBUTORS for 3.4.40 updated CHANGELOG for 3.4.40 [WebProfilerBundle] changed label of peak memory usage in the time & memory panels (MB into MiB) add tests for the ConstraintViolationBuilder class Improve dirname usage [PhpUnitBridge] Use COMPOSER_BINARY env var if available Allow invalidateTags calls to be traced by data collector [YAML] escape DEL(\x7f) fix compatibility with phpunit 9 [Cache] skip APCu in chains when the backend is disabled [Mailer] Add a comment to avoid more wrong PRs on this piece of code [Form] apply automatically step=1 for datetime-local input Fixing a bug where class_alias would cause incorrect items in debug:autowiring [DependencyInjection][ServiceSubscriber] Support late aliases
2 parents be7811a + fdacdf1 commit 3fd5aec

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

Command/DebugAutowiringCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
$serviceIdsNb = 0;
104104
foreach ($serviceIds as $serviceId) {
105105
$text = [];
106+
$resolvedServiceId = $serviceId;
106107
if (0 !== strpos($serviceId, $previousId)) {
107108
$text[] = '';
108-
if ('' !== $description = Descriptor::getClassDescription($serviceId, $serviceId)) {
109+
if ('' !== $description = Descriptor::getClassDescription($serviceId, $resolvedServiceId)) {
109110
if (isset($hasAlias[$serviceId])) {
110111
continue;
111112
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
4+
5+
class_alias(
6+
ClassAliasTargetClass::class,
7+
__NAMESPACE__ . '\ClassAliasExampleClass'
8+
);
9+
10+
if (false) {
11+
class ClassAliasExampleClass
12+
{
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
4+
5+
class ClassAliasTargetClass
6+
{
7+
}

Tests/Functional/DebugAutowiringCommandTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,16 @@ public function testSearchNotAliasedServiceWithAll()
9797
$tester->run(['command' => 'debug:autowiring', 'search' => 'redirect', '--all' => true]);
9898
$this->assertStringContainsString('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay());
9999
}
100+
101+
public function testNotConfusedByClassAliases()
102+
{
103+
static::bootKernel(['test_case' => 'ContainerDebug', 'root_config' => 'config.yml']);
104+
105+
$application = new Application(static::$kernel);
106+
$application->setAutoExit(false);
107+
108+
$tester = new ApplicationTester($application);
109+
$tester->run(['command' => 'debug:autowiring', 'search' => 'ClassAlias']);
110+
$this->assertStringContainsString('Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass (public)', $tester->getDisplay());
111+
}
100112
}

Tests/Functional/app/ContainerDebug/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
public: false
1414
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass:
1515
class: Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass
16+
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass: '@public'
1617
env:
1718
class: stdClass
1819
arguments:

0 commit comments

Comments
 (0)