From 444072509418d6e63acee31efbc18477eb8e5d2b Mon Sep 17 00:00:00 2001 From: Youssef Benhssaien Date: Sun, 15 Nov 2020 22:18:17 +0100 Subject: [PATCH] Section method only in ConsoleOutputInterface --- console.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/console.rst b/console.rst index ad9bb8c16e6..f49296cd47f 100644 --- a/console.rst +++ b/console.rst @@ -181,8 +181,18 @@ which returns an instance of { protected function execute(InputInterface $input, OutputInterface $output) { + // The section() method is only available in classes that implement ConsoleOutputInterface + if (!$output instanceof ConsoleOutputInterface) { + throw new LogicException(sprintf( + 'This command accepts only an instance of "%s", an instance of "%s" is given', + ConsoleOutputInterface::class, + \get_class($output) + )); + } + $section1 = $output->section(); $section2 = $output->section(); + $section1->writeln('Hello'); $section2->writeln('World!'); // Output displays "Hello\nWorld!\n" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy