8000 feature #25290 [FrameworkBundle] debug:autowiring: don't list FQCN wh… · symfony/symfony@7744e8f · GitHub
[go: up one dir, main page]

Skip to content

Commit 7744e8f

Browse files
committed
feature #25290 [FrameworkBundle] debug:autowiring: don't list FQCN when they are aliased (nicolas-grekas)
This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] debug:autowiring: don't list FQCN when they are aliased | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In order to favor type-hinting for interfaces, I propose to not list the class as explicitly autowireable when an alias exists for it. Which means displaying only ``` App\FooInterface alias to App\Foo ``` instead of ``` App\Foo App\FooInterface alias to App\Foo ``` ping @weaverryan Commits ------- 8cbfa1e [FrameworkBundle] debug:autowiring: don't list FQCN when they are aliased
2 parents 279dc46 + 8cbfa1e commit 7744e8f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
8585
}
8686
$io->newLine();
8787
$tableRows = array();
88+
$hasAlias = array();
8889
foreach ($serviceIds as $serviceId) {
89-
$tableRows[] = array(sprintf('<fg=cyan>%s</fg=cyan>', $serviceId));
9090
if ($builder->hasAlias($serviceId)) {
91+
$tableRows[] = array(sprintf('<fg=cyan>%s</fg=cyan>', $serviceId));
9192
$tableRows[] = array(sprintf(' alias to %s', $builder->getAlias($serviceId)));
93+
$hasAlias[(string) $builder->getAlias($serviceId)] = true;
94+
} else {
95+
$tableRows[$serviceId] = array(sprintf('<fg=cyan>%s</fg=cyan>', $serviceId));
9296
}
9397
}
9498

95-
$io->table(array(), $tableRows);
99+
$io->table(array(), array_diff_key($tableRows, $hasAlias));
96100
}
97101
}

0 commit comments

Comments
 (0)
0