Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:

- name: "Downgrade brick/math in lock file, to test compatibility with older versions"
run: |
composer update brick/math:"0.11.0"
composer update brick/math:"0.14.2"

- name: "Install dependencies (Composer)"
uses: "ramsey/composer-install@v3"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"php": "^8.2",
"brick/math": "^0.11 || ^0.12 || ^0.13 || ^0.14"
"brick/math": "^0.14.2 || ^0.15 || ^0.16 || ^0.17"
},
"require-dev": {
"captainhook/captainhook": "^5.25",
Expand Down
20 changes: 10 additions & 10 deletions src/Math/BrickMathCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
final class BrickMathCalculator implements CalculatorInterface
{
private const ROUNDING_MODE_MAP = [
RoundingMode::UNNECESSARY => BrickMathRounding::UNNECESSARY,
RoundingMode::UP => BrickMathRounding::UP,
RoundingMode::DOWN => BrickMathRounding::DOWN,
RoundingMode::CEILING => BrickMathRounding::CEILING,
RoundingMode::FLOOR => BrickMathRounding::FLOOR,
RoundingMode::HALF_UP => BrickMathRounding::HALF_UP,
RoundingMode::HALF_DOWN => BrickMathRounding::HALF_DOWN,
RoundingMode::HALF_CEILING => BrickMathRounding::HALF_CEILING,
RoundingMode::HALF_FLOOR => BrickMathRounding::HALF_FLOOR,
RoundingMode::HALF_EVEN => BrickMathRounding::HALF_EVEN,
RoundingMode::UNNECESSARY => BrickMathRounding::Unnecessary,
RoundingMode::UP => BrickMathRounding::Up,
RoundingMode::DOWN => BrickMathRounding::Down,
RoundingMode::CEILING => BrickMathRounding::Ceiling,
RoundingMode::FLOOR => BrickMathRounding::Floor,
RoundingMode::HALF_UP => BrickMathRounding::HalfUp,
RoundingMode::HALF_DOWN => BrickMathRounding::HalfDown,
RoundingMode::HALF_CEILING => BrickMathRounding::HalfCeiling,
RoundingMode::HALF_FLOOR => BrickMathRounding::HalfFloor,
RoundingMode::HALF_EVEN => BrickMathRounding::HalfEven,
];

public function add(NumberInterface $augend, NumberInterface ...$addends): NumberInterface
Expand Down
5 changes: 3 additions & 2 deletions src/Type/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ public function toString(): string
{
/** @var numeric-string $microseconds */
$microseconds = sprintf('%06s', $this->microseconds->toString());
/** @var numeric-string $time */
$time = "{$this->seconds->toString()}.$microseconds";

/** @var numeric-string */
return "{$this->seconds->toString()}.$microseconds";
return $time;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Math/BrickMathCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ public function testFromBaseThrowsException(): void
$calculator = new BrickMathCalculator();

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('"o" is not a valid character in base 16');
$this->expectExceptionMessageMatches(
'/(\"o\" is not a valid character in base 16\.|Character \"o\" is not valid in base 16\.)/'
);

$calculator->fromBase('foobar', 16);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/UuidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,8 @@ public function test32BitMatch64BitForOneHourPeriod(): void
);

// Assert that the time matches
$usecAdd = BigDecimal::of($usec)->dividedBy('1000000', 14, RoundingMode::HALF_UP);
$testTime = BigDecimal::of($currentTime)->plus($usecAdd)->toScale(0, RoundingMode::DOWN);
$usecAdd = BigDecimal::of($usec)->dividedBy('1000000', 14, RoundingMode::HalfUp);
$testTime = BigDecimal::of($currentTime)->plus($usecAdd)->toScale(0, RoundingMode::Down);
$this->assertSame((string) $testTime, (string) $uuid64->getDateTime()->getTimestamp());
$this->assertSame((string) $testTime, (string) $uuid32->getDateTime()->getTimestamp());
}
Expand Down