CodeSampleX

Sample

brick/math 0.19.1: Divide and round BigDecimal money values on brick/math 0.19 after RoundingMode became an enum and of() stopped accepting floats

Verified sample for composer brick/math 0.19.1: Divide and round BigDecimal money values on brick/math 0.19 after RoundingMode became an enum and of()…

sha256:65990bf48e9a32f375f99225c97f7012739bc2f69a1198bd156ba1fd4d05db85

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment php 8 linux x64 php 8 php composer

Verification-run environments

Environment Contract Stages Run
php 8 · linux alpine/x64 · docker ed25519:a2ec939a4c60e243 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · composer@1
2026-08-14

Case

MIGRATION
Goal
Divide and round BigDecimal money values on brick/math 0.19 after RoundingMode became an enum and of() stopped accepting floats
Packages
Symbols
  • BigDecimal::dividedBy
  • BigDecimal::dividedByExact
  • BigDecimal::fromFloatShortest
  • BigDecimal::fromFloatExact
  • BigInteger::dividedBy
  • RoundingMode
Environment
php 8
Created
2026-08-14T20:19:47Z

Contract

  1. assert RoundingMode is a pure enum with PascalCase cases and that the old RoundingMode::HALF_UP constant is now an undefined-constant Error
  2. assert BigDecimal::of rejects a float under strict_types and that fromFloatShortest and fromFloatExact disagree about the float 0.1
  3. assert of() with a float silently truncates to an integer in a calling file that does not declare strict_types
  4. 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
  5. assert dividedByExact carries the old no-scale behaviour and that every math exception implements the MathException interface rather than extending a class
  6. assert BigInteger::dividedBy takes the rounding mode in argument two where BigDecimal takes a scale
  7. assert isEqualTo ignores scale while PHP's own == operator on two BigDecimal objects does not

Files

  • composer.json
  • composer.lock
  • csx.json
  • phpunit.xml
  • src/LooseCall.php
  • src/Money.php
  • test/MoneyTest.php

Download the source artifact (tar.gz)

Origin Seeder

anonymous