mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 05:00:08 +02:00
Fixed exception.
This commit is contained in:
parent
a28e81065f
commit
e3800e4a24
1 changed files with 2 additions and 4 deletions
|
@ -62,17 +62,15 @@ class AmountFormatter
|
||||||
/**
|
/**
|
||||||
* Formats the given value using the measurement unit and options.
|
* Formats the given value using the measurement unit and options.
|
||||||
*
|
*
|
||||||
|
* @param float|string|int $value
|
||||||
* @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting.
|
* @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting.
|
||||||
* If set to null, it is assumed that the part amount is measured in pieces.
|
* If set to null, it is assumed that the part amount is measured in pieces.
|
||||||
*
|
*
|
||||||
* @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting.
|
|
||||||
* If set to null, it is assumed that the part amount is measured in pieces.
|
|
||||||
*
|
|
||||||
* @return string The formatted string
|
* @return string The formatted string
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException thrown if $value is not numeric
|
* @throws InvalidArgumentException thrown if $value is not numeric
|
||||||
*/
|
*/
|
||||||
public function format(float $value, ?MeasurementUnit $unit = null, array $options = [])
|
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
|
||||||
{
|
{
|
||||||
if (! is_numeric($value)) {
|
if (! is_numeric($value)) {
|
||||||
throw new InvalidArgumentException('$value must be an numeric value!');
|
throw new InvalidArgumentException('$value must be an numeric value!');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue