diff --git a/system/Files/FileSizeUnit.php b/system/Files/FileSizeUnit.php index 49dac2cebf25..5345026b65d5 100644 --- a/system/Files/FileSizeUnit.php +++ b/system/Files/FileSizeUnit.php @@ -15,12 +15,13 @@ enum FileSizeUnit: int { - case B = 0; - case KB = 1; - case MB = 2; - case GB = 3; - case TB = 4; - + /** + * Allows the creation of a FileSizeUnit from Strings like "kb" or "mb" + * + * @return FileSizeUnit + * + * @throws \InvalidArgumentException + */ public static function fromString(string $unit): self { return match (strtolower($unit)) { @@ -29,7 +30,13 @@ public static function fromString(string $unit): self 'mb' => self::MB, 'gb' => self::GB, 'tb' => self::TB, - default => throw new InvalidArgumentException("Invalid unit: $unit"), + default => throw new \InvalidArgumentException("Invalid unit: $unit"), }; } + + case B = 0; + case KB = 1; + case MB = 2; + case GB = 3; + case TB = 4; }