Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
allanmcarvalho committed Nov 20, 2023
2 parents 0f89197 + 77957e7 commit 575e1ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Numerable;

use Exception;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use InvalidArgumentException;
Expand Down Expand Up @@ -233,7 +232,8 @@ public static function round(int|float $value, int $precision = 0, int|RoundMode
{
$mode = is_int($mode) ? RoundMode::from($mode) : $mode;
$multiplier = pow(10, $precision);
return match($mode) {

return match ($mode) {
RoundMode::HALF_UP,
RoundMode::HALF_ODD,
RoundMode::HALF_EVEN,
Expand All @@ -252,7 +252,8 @@ public static function roundAsMultipleOf(
int|RoundMode $mode = RoundMode::HALF_UP
): int|float {
$parts = self::round($value / $multiple, 0, $mode);
return self::round($parts * $multiple,ini_get('precision') - 1);

return self::round($parts * $multiple, ini_get('precision') - 1);
}

/**
Expand Down Expand Up @@ -326,7 +327,7 @@ public static function toFormat(
$prefix = $value > 0 ? $prefix.'+' : $prefix;
}

return $prefix . $formatter->format($value) . $suffix;
return $prefix.$formatter->format($value).$suffix;
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/NumberTakeAPartTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use Numerable\Number;
use Numerable\Numerable;

it('can get a simple part', function () {
expect(Number::takeAPart(100, 0.25))
Expand Down

0 comments on commit 575e1ec

Please sign in to comment.