-
Notifications
You must be signed in to change notification settings - Fork 443
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
Money's internal amount should be a string #134
Conversation
6eed990
to
1d78353
Compare
In order to create a |
* | ||
* @return int | ||
*/ | ||
private function castString($amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a separate method for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we really do not need it. Removed it, and squashed again.
1d78353
to
4cc1d3a
Compare
@@ -47,7 +47,7 @@ | |||
]; | |||
|
|||
/** | |||
* @param int $amount Amount, expressed in the smallest units of $currency (eg cents) | |||
* @param int|string $amount Amount,expressed in the smallest units of $currency (eg cents) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say we need that space after the comma.
4966df8
to
b977099
Compare
Well, I tend accept this merge, but still need to get used to the fact that amount will be stored as string. |
@sagikazarmark I agree. It is a big change. #115 was more comprehensive than I thought at first. |
Merging the deprecation PR caused some conflicts. |
Yeah, and now I need to rebase? :) Still don't know how, sorry about that... |
No problem, I will do it. |
Conflicts solved in #136 |
Some months ago I was testing how to deal with bit integers and I did this fork: https://github.com/josecelano/money/blob/master/lib/Money/BigMoney.php Instead of using integer or string for the amount I used another class. In this implementation Money has not the responsibility to deal with bit integers and it delegates to another class. The only problem is that library uses only |
@josecelano The solution I will propose soon will have the following structure.
When the RFC for |
Sorry,there was definitely a misunderstanding. What I called BigMoney is an implementation of Money which allows big integers, not decimals. I used Decimal class but internally I force the constrain of not using decimals, I mean all values would have no deciaml part even if that class allows it. But the idea I want to expose is you could use another class to store the amount and delegate to that class the responsabiliti of dealing with bit integers. In fact, I was looking for a |
Yeah, BigMoney casued a lot of confusion in me as well. But it refers to the precision of the value, not the integer size. |
Fixes #133.