Skip to content

Add tests and fix isNonZero bug#3

Merged
simPod merged 1 commit intomainfrom
feat/tests
Mar 10, 2026
Merged

Add tests and fix isNonZero bug#3
simPod merged 1 commit intomainfrom
feat/tests

Conversation

@simPod
Copy link
Owner

@simPod simPod commented Mar 10, 2026

Summary

  • Add PHPUnit tests for both math and money packages using PHPStan's TypeInferenceTestCase with assertVariableCertainty
  • Fix isNonZero() in math extensions: add IntegerType guard to prevent false positives for BigInteger object types (ConstantIntegerType(0)->isSuperTypeOf(ObjectType) incorrectly returned no())
  • Fix Money::zero() narrowing to return explicit UnknownCurrencyException instead of falling back to missing @throws annotation
  • Add CI workflow for tests with PHP 8.4 and 8.5

Test plan

  • 15 math tests pass
  • 15 money tests pass
  • PHPStan clean on both packages
  • phpcs clean on both packages
  • CI green

- Add PHPUnit tests for both math and money packages using
  PHPStan's TypeInferenceTestCase with assertVariableCertainty
- Fix isNonZero() in math extensions: add IntegerType guard to
  prevent false positives for BigInteger object types
- Fix Money::zero() narrowing to return explicit UnknownCurrencyException
  instead of falling back to missing @throws annotation
- Add CI workflow for tests with PHP 8.4 and 8.5
@simPod simPod merged commit fa57db1 into main Mar 10, 2026
8 checks passed
@simPod simPod deleted the feat/tests branch March 10, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant