Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflict with ServiceSubscriberTrait #15

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/InvokableServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static function(\ReflectionParameter $parameter): ?string {

public function execute(InputInterface $input, OutputInterface $output): int
{
foreach (static::getSubscribedServices() as $serviceId) {
foreach (self::getSubscribedServices() as $serviceId) {
$optional = 0 === \mb_strpos($serviceId, '?');
$serviceId = \ltrim($serviceId, '?');

Expand Down
2 changes: 2 additions & 0 deletions tests/Fixture/Command/ServiceSubscriberTraitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Psr\Log\LoggerInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Service\Attribute\SubscribedService;
use Symfony\Contracts\Service\ServiceSubscriberTrait;
use Zenstruck\Console\InvokableServiceCommand;
use Zenstruck\Console\IO;
Expand All @@ -24,6 +25,7 @@ public function __invoke(IO $io, RouterInterface $router): void
$io->comment(\sprintf('LoggerInterface: %s', get_debug_type($this->logger())));
}

#[SubscribedService]
private function logger(): LoggerInterface
{
return $this->container->get(__METHOD__);
Expand Down