Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: psalm simplify positive-int|0 to non-negative-int (for src) #782

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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