Skip to content

Commit

Permalink
chore: psalm simplify positive-int|0 to non-negative-int (for src)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris8934 committed Jan 27, 2024
1 parent a829bd4 commit 7e816a8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Currencies/CryptoCurrencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class CryptoCurrencies implements Currencies
*
* @psalm-var non-empty-array<non-empty-string, array{
* symbol: non-empty-string,
* minorUnit: positive-int|0
* minorUnit: non-negative-int
* }>|null
*/
private static ?array $currencies = null;
Expand Down Expand Up @@ -64,7 +64,7 @@ static function ($code) {
*
* @psalm-return non-empty-array<non-empty-string, array{
* symbol: non-empty-string,
* minorUnit: positive-int|0
* minorUnit: non-negative-int
* }>
*/
private function getCurrencies(): array
Expand All @@ -79,7 +79,7 @@ private function getCurrencies(): array
/**
* @psalm-return non-empty-array<non-empty-string, array{
* symbol: non-empty-string,
* minorUnit: positive-int|0
* minorUnit: non-negative-int
* }>
*/
private function loadCurrencies(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Currencies/CurrencyList.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class CurrencyList implements Currencies
*/
private array $currencies;

/** @psalm-param array<non-empty-string, positive-int|0> $currencies */
/** @psalm-param array<non-empty-string, non-negative-int> $currencies */
public function __construct(array $currencies)
{
$this->currencies = $currencies;
Expand Down
6 changes: 3 additions & 3 deletions src/Currencies/ISOCurrencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class ISOCurrencies implements Currencies
* @psalm-var non-empty-array<non-empty-string, array{
* alphabeticCode: non-empty-string,
* currency: non-empty-string,
* minorUnit: positive-int|0,
* minorUnit: non-negative-int,
* numericCode: positive-int
* }>|null
*/
Expand Down Expand Up @@ -81,7 +81,7 @@ static function ($code) {
* @psalm-return non-empty-array<non-empty-string, array{
* alphabeticCode: non-empty-string,
* currency: non-empty-string,
* minorUnit: positive-int|0,
* minorUnit: non-negative-int,
* numericCode: positive-int
* }>
*/
Expand All @@ -98,7 +98,7 @@ private function getCurrencies(): array
* @psalm-return non-empty-array<non-empty-string, array{
* alphabeticCode: non-empty-string,
* currency: non-empty-string,
* minorUnit: positive-int|0,
* minorUnit: non-negative-int,
* numericCode: positive-int
* }>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private function round(string $amount, int $roundingMode): string
/**
* Round to a specific unit.
*
* @psalm-param positive-int|0 $unit
* @psalm-param non-negative-int $unit
* @psalm-param self::ROUND_* $roundingMode
*/
public function roundToUnit(int $unit, int $roundingMode = self::ROUND_HALF_UP): self
Expand Down
2 changes: 1 addition & 1 deletion src/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static function roundMoneyValue(string $moneyValue, int $targetDigits, in

if ($shouldRound && $moneyValue[$valueLength - $havingDigits + $targetDigits] >= 5) {
$position = $valueLength - $havingDigits + $targetDigits;
/** @psalm-var positive-int|0 $addend */
/** @psalm-var non-negative-int $addend */
$addend = 1;

while ($position > 0) {
Expand Down

0 comments on commit 7e816a8

Please sign in to comment.