File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -173,21 +173,19 @@ called "output sections". Create one or more of these sections when you need to
173
173
clear and overwrite the output information.
174
174
175
175
Sections are created with the
176
- :method: `Symfony\\ Component\\ Console\\ Output\\ ConsoleOutput::section ` method,
177
- which returns an instance of
176
+ :method: `ConsoleOutput::section() < Symfony\\ Component\\ Console\\ Output\\ ConsoleOutput::section> `
177
+ method, which returns an instance of
178
178
:class: `Symfony\\ Component\\ Console\\ Output\\ ConsoleSectionOutput `::
179
179
180
+ // ...
181
+ use Symfony\Component\Console\Output\ConsoleOutputInterface;
182
+
180
183
class MyCommand extends Command
181
184
{
182
185
protected function execute(InputInterface $input, OutputInterface $output)
183
186
{
184
- // The section() method is only available in classes that implement ConsoleOutputInterface
185
187
if (!$output instanceof ConsoleOutputInterface) {
186
- throw new LogicException(sprintf(
187
- 'This command accepts only an instance of "%s", an instance of "%s" is given',
188
- ConsoleOutputInterface::class,
189
- \get_class($output)
190
- ));
188
+ throw new \LogicException('This command accepts only an instance of "ConsoleOutputInterface".');
191
189
}
192
190
193
191
$section1 = $output->section();
You can’t perform that action at this time.
0 commit comments