File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -196,13 +196,17 @@ which returns an instance of
196196 protected function execute(InputInterface $input, OutputInterface $output)
197197 {
198198 // The section() method is only available in classes that implement ConsoleOutputInterface
199- if ($output instanceof ConsoleOutputInterface) {
200- $section1 = $output->section();
201- $section2 = $output->section();
202- } else {
203- $section1 = $section2 = $output;
199+ if (!$output instanceof ConsoleOutputInterface) {
200+ throw new InvalidArgumentException(sprintf(
201+ 'This command accepts only an instance of "%s", an instance of "%s" is given',
202+ ConsoleOutputInterface::class,
203+ \get_class($output)
204+ ));
204205 }
205-
206+
207+ $section1 = $output->section();
208+ $section2 = $output->section();
209+
206210 $section1->writeln('Hello');
207211 $section2->writeln('World!');
208212 // Output displays "Hello\nWorld!\n"
You can’t perform that action at this time.
0 commit comments