Commit 8038347e authored by Thorsten Buss's avatar Thorsten Buss
Browse files

FIX: only real amount was allowed in constructor - unable to parse a string there

parent 22c78896
......@@ -37,7 +37,7 @@ class Money
*/
public function __construct($amount, $currency=null, $parseAmountAsMoneyString=false)
{
if (!is_int($amount) && !ctype_digit($amount)) { // only numbers(int) - as string or int type
if (!$parseAmountAsMoneyString && !is_int($amount) && !ctype_digit($amount)) { // only numbers(int) - as string or int type
throw new InvalidArgumentException("The first parameter of Money must be an integer. It's the amount, expressed in the smallest units of currency (eg cents)");
}
$this->currency = Currency::getInstance($currency);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment