sebastianbergmann/money — pull request #9 by camspiers (2014-03-07 04:02:04+00:00)
Title: Provide new functionality to ensure that internal operations don't disguise imprecision

In certain cases it is possible for the Money object to deal in numbers
which overflow the integer limit of PHP this introduces errors that a
users of the package will not be aware of. This commit causes
failure by throwing an exception when a to-be-cast number is out of integer
bounds.

An example:

On a 64-bit system with a PHP_INT_MAX of 9223372036854775807 the following
code can run without error, and without the user realising an error state
has been produced (the error state is that ->amount will be -9223372036854775808):

```
$m = new Money(4611686018427387904, new Currency('USD'));
$newM = $m->multiply(2);
```

Internally, the following analogous operation is occurring:

```
intval(4611686018427387904 * 2)
```

Which produces the result "-9223372036854775808", a clear error state.