diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yaml similarity index 99% rename from .github/workflows/ci.yml rename to .github/workflows/ci.yaml index 6fbf700..719716e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -# Inspired by Sebastian Bergmann's phpunit action workflow https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yml +# Inspired by Sebastian Bergmann's phpunit action workflow https://github.com/sebastianbergmann/phpunit/blob/main/.github/workflows/ci.yaml name: "CI" diff --git a/src/Arguments/Option.php b/src/Arguments/Option.php index 5602af4..332c514 100644 --- a/src/Arguments/Option.php +++ b/src/Arguments/Option.php @@ -46,7 +46,7 @@ public function verifiesType(mixed $value): bool }; } - /** Returns the php property for the Arguments\Argument class */ + /** Returns the PHP property for the Arguments\Argument class */ public function getPhpProperty(): string { return match ($this) { diff --git a/src/ProgressBar.php b/src/ProgressBar.php index 8848a46..b664235 100644 --- a/src/ProgressBar.php +++ b/src/ProgressBar.php @@ -259,7 +259,7 @@ public function getCurrent(): int private function printTime(): void { // Time color by its total time - $time = Style::stylize($this->getFormattedTime($this->totalTime), fg: match (true) { + $time = Style::stylize(self::getFormattedTime($this->totalTime), fg: match (true) { $this->totalTime <= 500 => Foreground::GREEN, $this->totalTime <= 2000 => Foreground::YELLOW, default => Foreground::RED @@ -267,7 +267,7 @@ private function printTime(): void // Allocated memory by its usage $memoryUsage = memory_get_usage(true); - $memory = Style::stylize($this->getFormattedMemory($memoryUsage), fg: match (true) { + $memory = Style::stylize(self::getFormattedMemory($memoryUsage), fg: match (true) { $memoryUsage <= 268435456 => Foreground::LIGHT_GREEN, // 256MB $memoryUsage <= 536870912 => Foreground::YELLOW, // 512MB default => Foreground::RED diff --git a/src/Style.php b/src/Style.php index 91ac0d6..a844bbf 100755 --- a/src/Style.php +++ b/src/Style.php @@ -7,6 +7,8 @@ use function sprintf; use function get_class; use function preg_match_all; +use function substr; +use function trigger_error; use function get_called_class; use function str_replace; @@ -24,9 +26,9 @@ class Style */ public static function inline( string $string, - Style\Background $bg = null, - Style\Foreground $fg = null, - Style\Attribute $at = null + ?Style\Background $bg = null, + ?Style\Foreground $fg = null, + ?Style\Attribute $at = null ): void { print self::stylize($string, $bg, $fg, $at); } @@ -36,9 +38,9 @@ public static function inline( */ public static function outline( string $string, - Style\Background $bg = null, - Style\Foreground $fg = null, - Style\Attribute $at = null + ?Style\Background $bg = null, + ?Style\Foreground $fg = null, + ?Style\Attribute $at = null ): void { print self::stylize($string, $bg, $fg, $at) . PHP_EOL; } @@ -202,9 +204,9 @@ public static function tag(string $tag): void */ public static function stylize( string $string, - Style\Background $bg = null, - Style\Foreground $fg = null, - Style\Attribute $at = null + ?Style\Background $bg = null, + ?Style\Foreground $fg = null, + ?Style\Attribute $at = null ): string { if (!$bg && !$fg && !$at) { return $string;