Skip to content

Commit

Permalink
Merge pull request #13 from Richardds/fix-float-to-int
Browse files Browse the repository at this point in the history
Fix float to int
  • Loading branch information
Richardds authored Jan 18, 2023
2 parents e0877e6 + 7a9dcd1 commit cc39a61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ECBConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function list(bool $asArray = false): array
* @return int|array
* @throws ECBException
*/
public function convert(int $amount, $currency_code, callable $callback)
public function convert(float $amount, $currency_code, callable $callback)
{
$this->check();

Expand All @@ -122,7 +122,7 @@ public function convert(int $amount, $currency_code, callable $callback)

return $results;
}

// All currencies
if ($currency_code === '*') {
$results = [];
Expand Down Expand Up @@ -162,7 +162,7 @@ public function reloadExchangeReferences(): void
* @return int|array
* @throws ECBException
*/
public function toForeign(int $amount, string $currency_code, ?int $precision = null)
public function toForeign(float $amount, string $currency_code, ?int $precision = null)
{
return $this->convert($amount, $currency_code, function ($amount, $rate) use ($precision) {
$val = $amount * $rate;
Expand Down

0 comments on commit cc39a61

Please sign in to comment.