Skip to content

Commit

Permalink
Merge pull request #4 from AReveron/cherrypick/fix-call-method
Browse files Browse the repository at this point in the history
Ported fix applied in version 1.0.1 to cake5 branch
  • Loading branch information
AReveron authored Feb 23, 2024
2 parents 51dfaf6 + a4ee2c2 commit cc01676
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/vendor/
/.idea/
/.phpunit.cache
/.ddev/
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.1] - 2024-02-23
- Ported changes applied in tag `1.0.1`

## [1.0.1] - 2024-02-23

### Fixed
- Fixed issue where `__call()` method sometimes returned an object with class `\Money\Money` instead of `\CakeDC\Money\Money`.

## [0.0.1] - 2021-06-18

* Initial version
* Initial version
7 changes: 6 additions & 1 deletion src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit cc01676

Please sign in to comment.