Skip to content

Commit

Permalink
Update service definition and constructor do not break BC and add a r…
Browse files Browse the repository at this point in the history
…eturn type
  • Loading branch information
SerkanYildiz committed Mar 10, 2019
1 parent d31b528 commit ef540ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -33,11 +33,11 @@ class DebugAutowiringCommand extends ContainerDebugCommand
private $supportsHref;
private $fileLinkFormatter;

public function __construct(FileLinkFormatter $fileLinkFormatter = null)
public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
{
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
$this->fileLinkFormatter = $fileLinkFormatter;
parent::__construct();
parent::__construct($name);
}

/**
Expand Down Expand Up @@ -135,13 +135,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->newLine();
}

private function getFileLink(string $class)
private function getFileLink(string $class): string
{
if (null === $this->fileLinkFormatter
|| (null === $r = $this->getContainerBuilder()->getReflectionClass($class, false))) {
return '';
}

return $this->fileLinkFormatter->format($r->getFileName(), $r->getStartLine());
return (string) $this->fileLinkFormatter->format($r->getFileName(), $r->getStartLine());
}
}
Expand Up @@ -66,6 +66,7 @@
</service>

<service id="console.command.debug_autowiring" class="Symfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand">
<argument />
<argument type="service" id="debug.file_link_formatter" on-invalid="null"/>
<tag name="console.command" command="debug:autowiring" />
</service>
Expand Down

0 comments on commit ef540ed

Please sign in to comment.