diff --git a/.gitignore b/.gitignore index 2a55d71..56b0dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ /config/Migrations/schema-dump-default.lock /vendor/ /.idea/ -/.phpunit.cache \ No newline at end of file +/.phpunit.cache +/.ddev/ diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e0afd..df65918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +* Fixed issue where `__call()` method sometimes returned an object with class \Money\Money instead of CakeDC\Money\. + ## [0.0.1] - 2021-06-18 -* Initial version \ No newline at end of file +* Initial version diff --git a/src/Money.php b/src/Money.php index 2ebc7cf..cc2a55a 100644 --- a/src/Money.php +++ b/src/Money.php @@ -51,7 +51,12 @@ public function __call($name, $arguments) { $arguments = self::processArguments($arguments); - return call_user_func_array([$this->_money, $name], $arguments); + $result = call_user_func_array([$this->_money, $name], $arguments); + if ($result instanceof MoneyPHP) { + return new self($result); + } + + return $result; } /**