Skip to content

Commit

Permalink
Fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed May 15, 2023
1 parent 0359e4c commit f8ffda7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Currency/CurrencyAlpha3.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function toCurrencyName(): CurrencyName
return BackedEnum::fromKey(CurrencyName::class, $this->name);
}

public function getSymbol(): CurrencySymbol
public function getSymbol(): ?CurrencySymbol
{
return CurrencySymbol::forCurrency($this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Currency/CurrencyName.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function toCurrencyNumeric(): CurrencyNumeric
return BackedEnum::fromKey(CurrencyNumeric::class, $this->name);
}

public function getSymbol(): CurrencySymbol
public function getSymbol(): ?CurrencySymbol
{
return CurrencySymbol::forCurrency($this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Currency/CurrencyNumeric.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function toCurrencyName(): CurrencyName
return BackedEnum::fromKey(CurrencyName::class, $this->name);
}

public function getSymbol(): CurrencySymbol
public function getSymbol(): ?CurrencySymbol
{
return CurrencySymbol::forCurrency($this);
}
Expand Down
6 changes: 5 additions & 1 deletion src/Currency/CurrencySymbol.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ enum CurrencySymbol: string

public static function forCurrency(CurrencyAlpha3|CurrencyName|CurrencyNumeric $currency): ?self
{
return match($currency->toCurrencyAlpha3()) {
if ($currency instanceof CurrencyAlpha3 === false) {
$currency = $currency->toCurrencyAlpha3();
}

return match($currency) {
CurrencyAlpha3::ADB_Unit_of_Account => null,
CurrencyAlpha3::Afghani => self::Afghani,
CurrencyAlpha3::Algerian_Dinar => self::Algerian_Dinar,
Expand Down

0 comments on commit f8ffda7

Please sign in to comment.