mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-01 19:00:20 +02:00
Add strtolower
for fromName
match statement (#1941)
Changes the `fromName` method to be case-insensitive for more flexible use.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user