mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-03 19:57:41 +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
|
public static function fromName(string $name): self
|
||||||
{
|
{
|
||||||
return match ($name) {
|
return match (strtolower($name)) {
|
||||||
'debug', 'Debug', 'DEBUG' => self::Debug,
|
'debug' => self::Debug,
|
||||||
'info', 'Info', 'INFO' => self::Info,
|
'info' => self::Info,
|
||||||
'notice', 'Notice', 'NOTICE' => self::Notice,
|
'notice' => self::Notice,
|
||||||
'warning', 'Warning', 'WARNING' => self::Warning,
|
'warning' => self::Warning,
|
||||||
'error', 'Error', 'ERROR' => self::Error,
|
'error' => self::Error,
|
||||||
'critical', 'Critical', 'CRITICAL' => self::Critical,
|
'critical' => self::Critical,
|
||||||
'alert', 'Alert', 'ALERT' => self::Alert,
|
'alert' => self::Alert,
|
||||||
'emergency', 'Emergency', 'EMERGENCY' => self::Emergency,
|
'emergency' => self::Emergency,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user