Skip to content

Commit 4a417f1

Browse files
committed
Antoine's Review
1 parent a59a80c commit 4a417f1

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

components/console/helpers/tree.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ inside your console command::
3535
{
3636
// ...
3737

38-
protected function execute(SymfonyStyle $io): int
38+
public function __invoke(SymfonyStyle $io): int
3939
{
4040
$node = TreeNode::fromValues([
4141
'config/',

console/style.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ which allow to create *semantic* commands and forget about their styling.
4242
Basic Usage
4343
-----------
4444

45-
In your `__invoke` method, type the :class:`Symfony\\Component\\Console\\Style\\SymfonyStyle`
46-
argument. Then, you can start using any of its helpers, such as ``title()``, which
45+
In your `__invoke` method, add an argument of type :class:`Symfony\\Component\\Console\\Style\\SymfonyStyle`.
46+
Then, you can start using any of its helpers, such as ``title()``, which
4747
displays the title of the command::
4848

4949
// src/Command/MyCommand.php

logging/monolog_console.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ When a lot of logging has to happen, it's cumbersome to print information
1010
depending on the verbosity settings (``-v``, ``-vv``, ``-vvv``) because the
1111
calls 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

3534
The 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

Comments
 (0)