@@ -10,10 +10,9 @@ When a lot of logging has to happen, it's cumbersome to print information
1010depending on the verbosity settings (``-v ``, ``-vv ``, ``-vvv ``) because the
1111calls need to be wrapped in conditions. For example::
1212
13- use Symfony\Component\Console\Input\InputInterface;
1413 use Symfony\Component\Console\Output\OutputInterface;
1514
16- protected function execute(InputInterface $input, OutputInterface $output): int
15+ public function __invoke( OutputInterface $output): int
1716 {
1817 if ($output->isDebug()) {
1918 $output->writeln('Some info');
@@ -34,13 +33,12 @@ the current log level and the console verbosity.
3433
3534The example above could then be rewritten as::
3635
37- // src/Command/YourCommand .php
36+ // src/Command/MyCommand .php
3837 namespace App\Command;
3938
4039 use Psr\Log\LoggerInterface;
4140 use Symfony\Component\Console\Attribute\AsCommand;
4241 use Symfony\Component\Console\Command\Command;
43- use Symfony\Component\Console\Style\SymfonyStyle;
4442
4543 #[AsCommand(name: 'app:my-command')]
4644 class MyCommand
@@ -50,7 +48,7 @@ The example above could then be rewritten as::
5048 ) {
5149 }
5250
53- public function __invoke(SymfonyStyle $io ): int
51+ public function __invoke(): int
5452 {
5553 $this->logger->debug('Some info');
5654 $this->logger->notice('Some more info');
0 commit comments