File tree 1 file changed +10
-6
lines changed
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
196
196
protected function execute(InputInterface $input, OutputInterface $output)
197
197
{
198
198
// 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
+ ));
204
205
}
205
-
206
+
207
+ $section1 = $output->section();
208
+ $section2 = $output->section();
209
+
206
210
$section1->writeln('Hello');
207
211
$section2->writeln('World!');
208
212
// Output displays "Hello\nWorld!\n"
You can’t perform that action at this time.
0 commit comments