Skip to content

Force numeric-string return type in BigDecimal::__toString() and BigInteger::__toString() #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2025

Conversation

vudaltsov
Copy link
Contributor

Closes #89.

@return numeric-string cannot be added to BigRational, because '10/20' is not a numeric string. So I added numeric-string to BigDecimal and BigInteger classes only. This does not break LSP, because methods return types are covariant and numeric-string <: string.

I forced types via @var annotation, otherwise the refactoring would be huge and still in most places we will have to force type, for example where $sign is concatenated with $value.

@BenMorel
Copy link
Member

I forced types via @var annotation, otherwise the refactoring would be huge and still in most places we will have to force type, for example where $sign is concatenated with $value.

Looks reasonable.

@BenMorel BenMorel merged commit 9fdf3ec into brick:master Mar 29, 2025
17 checks passed
@BenMorel
Copy link
Member

Thank you, @vudaltsov!

@BenMorel
Copy link
Member

Released as 0.13.1.

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.

Add @return numeric-string to __toString()
2 participants