Skip to content

Commit

Permalink
Add strtolower for fromName match statement
Browse files Browse the repository at this point in the history
Changes the `fromName` method to be case-insensitive for more flexible use.
  • Loading branch information
Jonezzyboy authored Feb 5, 2025
1 parent 548eeb3 commit db4bf1c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Monolog/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ enum Level: int
*/
public static function fromName(string $name): self
{
return match ($name) {
'debug', 'Debug', 'DEBUG' => self::Debug,
'info', 'Info', 'INFO' => self::Info,
'notice', 'Notice', 'NOTICE' => self::Notice,
'warning', 'Warning', 'WARNING' => self::Warning,
'error', 'Error', 'ERROR' => self::Error,
'critical', 'Critical', 'CRITICAL' => self::Critical,
'alert', 'Alert', 'ALERT' => self::Alert,
'emergency', 'Emergency', 'EMERGENCY' => self::Emergency,
return match (strtolower($name)) {
'debug' => self::Debug,
'info' => self::Info,
'notice' => self::Notice,
'warning' => self::Warning,
'error' => self::Error,
'critical' => self::Critical,
'alert' => self::Alert,
'emergency' => self::Emergency,
};
}

Expand Down

0 comments on commit db4bf1c

Please sign in to comment.