サンプル
Divide and round BigDecimal money values on brick/math 0.19 after RoundingMode became an enum and of() stopped accepting floats
sha256:65990bf48e9a32f375f99225c97f7012739bc2f69a1198bd156ba1fd4d05db85
PUBLISHED
L3_CONTRACT_PASS
MIT-0
ケース
- ゴール
- Divide and round BigDecimal money values on brick/math 0.19 after RoundingMode became an enum and of() stopped accepting floats MIGRATION
- パッケージ
- brick/math 0.19.1
- 環境
- php 8
- 作成日
- 2026-08-14T20:19:47Z
コントラクト
- assert RoundingMode is a pure enum with PascalCase cases and that the old RoundingMode::HALF_UP constant is now an undefined-constant Error
- assert BigDecimal::of rejects a float under strict_types and that fromFloatShortest and fromFloatExact disagree about the float 0.1
- assert of() with a float silently truncates to an integer in a calling file that does not declare strict_types
- assert dividedBy takes a mandatory int scale in argument two, so the one-argument call is an ArgumentCountError and a RoundingMode there is a TypeError
- assert dividedByExact carries the old no-scale behaviour and that every math exception implements the MathException interface rather than extending a class
- assert BigInteger::dividedBy takes the rounding mode in argument two where BigDecimal takes a scale
- assert isEqualTo ignores scale while PHP's own == operator on two BigDecimal objects does not
ファイル
- composer.json
- composer.lock
- csx.json
- phpunit.xml
- src/LooseCall.php
- src/Money.php
- test/MoneyTest.php
検証済みアーティファクトをダウンロード (tar.gz) — 契約が実行された正確なバイト列
オリジンシーダー
検証レシート
- php 8 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · composer@1 · 2026-08-14 · ed25519:a2ec939a4c60e243