From 806b343d2bc1ed7454010b09e11ee9035130e14f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 26 Apr 2025 19:27:55 +0200 Subject: [PATCH] Config: remove some more output buffering I don't see why output buffering is needed here. The `DeepExitException` accepts/allows an empty string as the "message", so there is no reason to collect the screen output via buffering first, only to echo it out again as soon as the exception is caught (by the `Runner`) class. --- src/Config.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Config.php b/src/Config.php index 1a3f9c293f..5d4209e969 100644 --- a/src/Config.php +++ b/src/Config.php @@ -679,11 +679,8 @@ public function processShortArgument($arg, $pos) switch ($arg) { case 'h': case '?': - ob_start(); $this->printUsage(); - $output = ob_get_contents(); - ob_end_clean(); - throw new DeepExitException($output, 0); + throw new DeepExitException('', 0); case 'i' : ob_start(); Standards::printInstalledStandards(); @@ -796,11 +793,8 @@ public function processLongArgument($arg, $pos) { switch ($arg) { case 'help': - ob_start(); $this->printUsage(); - $output = ob_get_contents(); - ob_end_clean(); - throw new DeepExitException($output, 0); + throw new DeepExitException('', 0); case 'version': $output = 'PHP_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') '; $output .= 'by Squiz and PHPCSStandards'.PHP_EOL;