Skip to content

Commit

Permalink
Use numeric literal separator in file rule validation (#51781)
Browse files Browse the repository at this point in the history
Co-authored-by: Amir Khalife Soltani <[email protected]>
  • Loading branch information
AmirKhalifehSoltani and Amir Khalife Soltani authored Jun 12, 2024
1 parent 202422d commit 59284d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Validation/Rules/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ protected function toKilobytes($size)

return round(match (true) {
Str::endsWith($size, 'kb') => $value * 1,
Str::endsWith($size, 'mb') => $value * 1000,
Str::endsWith($size, 'gb') => $value * 1000000,
Str::endsWith($size, 'tb') => $value * 1000000000,
Str::endsWith($size, 'mb') => $value * 1_000,
Str::endsWith($size, 'gb') => $value * 1_000_000,
Str::endsWith($size, 'tb') => $value * 1_000_000_000,
default => throw new InvalidArgumentException('Invalid file size suffix.'),
});
}
Expand Down

0 comments on commit 59284d9

Please sign in to comment.