Skip to content

Commit

Permalink
Allow whole mixed type and use stringify to process it
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk committed May 28, 2024
1 parent 0f7ee65 commit 78e650e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ public static function value(


/**
* @template T of scalar|null
* @template T of mixed
* @param T $value
* @return ($strict is true ? int|float|null : T)
*/
public static function numeric(mixed $value, ?int $precision = null, bool $strict = true): mixed
{
$number = strtr(strval($value), [' ' => '', ',' => '.']);
$number = strtr(static::stringify($value), [' ' => '', ',' => '.']);

if (!$number || !is_numeric($number)) {
return $strict ? null : $value;
Expand Down

0 comments on commit 78e650e

Please sign in to comment.