From d7dd0ecc5abbc890401595eb440734b136c0e895 Mon Sep 17 00:00:00 2001 From: Kodie Grantham Date: Thu, 28 Nov 2024 16:30:32 -0600 Subject: [PATCH] Short-circut the missing method the same way we do line function --- src/Output/Color.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Output/Color.php b/src/Output/Color.php index d1c3211..f126ccc 100644 --- a/src/Output/Color.php +++ b/src/Output/Color.php @@ -235,11 +235,11 @@ public function __call(string $name, array $arguments): string } if (!method_exists($this, $name)) { - if (self::$colors_enabled) { - throw new InvalidArgumentException(sprintf('Style "%s" not defined', $name)); + if (!self::$colors_enabled) { + return $text; } - return $text; + throw new InvalidArgumentException(sprintf('Style "%s" not defined', $name)); } return $this->{$name}($text, $style);