Repository navigation
Conversation
CalculatorInterface::calculate() returns a float and the result was cast straight to int, which truncates. Sylius' DefaultCalculator happens to round before returning so stock installs were unaffected, but the interface makes no such promise and a custom or decorated tax calculator returning e.g. 219.8 would silently shave a cent off every price. Claude-Session: https://claude.ai/code/session_01P9NzuVPQGvaVR97HZFq98a
This was referenced Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sylius\Component\Taxation\Calculator\CalculatorInterface::calculate()returns afloat, andProductVariantPricesCalculatorcast it straight toint— which truncates.Stock installs are unaffected because Sylius'
DefaultCalculatorhappens toround()before returning. But that is an implementation detail of one implementation, not part of the interface contract, so a custom or decorated tax calculator returning e.g.219.8would silently shave a cent off every displayed price.(int) round(...)is free insurance. The new test uses a tax calculator returning219.8and asserts1220rather than the1219truncation would produce.Addresses the fourth bug in #5.
https://claude.ai/code/session_01P9NzuVPQGvaVR97HZFq98a