Skip to content

Commit

Permalink
Short-circut the missing method the same way we do line function
Browse files Browse the repository at this point in the history
  • Loading branch information
kodie committed Nov 28, 2024
1 parent e6097da commit d7dd0ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Output/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d7dd0ec

Please sign in to comment.