We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b73b941 commit 4440725Copy full SHA for 4440725
console.rst
@@ -181,8 +181,18 @@ which returns an instance of
181
{
182
protected function execute(InputInterface $input, OutputInterface $output)
183
184
+ // The section() method is only available in classes that implement ConsoleOutputInterface
185
+ 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
+ ));
191
+ }
192
+
193
$section1 = $output->section();
194
$section2 = $output->section();
195
196
$section1->writeln('Hello');
197
$section2->writeln('World!');
198
// Output displays "Hello\nWorld!\n"
0 commit comments