Skip to content

Commit

Permalink
upgrade phpstan to v1.11 and use error identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Apr 5, 2024
1 parent c01bf6a commit 6dea928
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"nunomaduro/collision": "^8.1",
"php-standard-library/phpstan-extension": "^1.0",
"phpbench/phpbench": "^1.2",
"phpstan/phpstan": "^1.10.66",
"phpstan/phpstan": "1.11.x-dev#c80f35e as 1.10.66",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^10.5",
"symfony/console": "^7.0",
Expand Down
30 changes: 18 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Bundle/FluentBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function numberFunction(
$number = new FluentNumber($number);
}

/** @phpstan-ignore-next-line */
/** @phpstan-ignore argument.type */
return $number->setLocale($this->locale)->setOptions($options);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Bundle/Types/FluentNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function original(): string
public function __toString(): string
{
return (new NumberFormatter($this->locale))->format(
/** @phpstan-ignore-next-line */
/** @phpstan-ignore argument.type */
$this->value, new Options(...$this->options),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Formatters/LocaleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static function splitLocale(string $locale): array
*/
private static function getFiles(string $type, string $language): array
{
/** @phpstan-ignore-next-line */
/** @phpstan-ignore return.type */
return glob(self::Path . "{$type}/{$language}*.php");
}

Expand Down
4 changes: 2 additions & 2 deletions src/Formatters/Number/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ private function fillForOther(?Currency $currency): void

$this->minimumFractionDigits ??= match ($this->style) {
'decimal', 'percent', 'unit' => 0,
/** @phpstan-ignore-next-line */
/** @phpstan-ignore property.nonObject */
'currency' => $currency->minorUnits,
};

$this->maximumFractionDigits ??= match ($this->style) {
'decimal', 'unit' => max($this->minimumFractionDigits, 3),
/** @phpstan-ignore-next-line */
/** @phpstan-ignore property.nonObject */
'currency' => max($this->minimumFractionDigits, $currency->minorUnits),
'percent' => max($this->minimumFractionDigits, 0),
};
Expand Down
2 changes: 1 addition & 1 deletion tests/Helpers/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private function loadCache(): void
File\write($this->path, '{}');
}

/** @phpstan-ignore-next-line */
/** @phpstan-ignore assign.propertyType */
$this->cache = Json\decode(File\read($this->path));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function count_values(array $values): array
$primary = $b['count'] <=> $a['count'];
$secondary = $a['value'] <=> $b['value'];

/** @phpstan-ignore-next-line */
/** @phpstan-ignore ternary.alwaysFalse */
return $primary ?: $secondary;
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Parser/Literals/NumberLiteralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static function assertValueAndPrecision(
): void {
$ast = (new FluentParser(true))->parseEntry($ftl);

/** @phpstan-ignore-next-line */
/** @phpstan-ignore property.notFound */
$expr = $ast->value->elements[0]->expression;

$parsed = Type\instance_of(NumberLiteralValue::class)->coerce($expr->parse());
Expand Down
2 changes: 1 addition & 1 deletion tests/Parser/Literals/StringLiteralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static function assertValue(string $value, string $ftl): void
{
$ast = (new FluentParser(true))->parseEntry($ftl);

/** @phpstan-ignore-next-line */
/** @phpstan-ignore property.notFound */
$expr = $ast->value->elements[0]->expression;

$parsed = Type\instance_of(StringLiteralValue::class)->coerce($expr->parse());
Expand Down

0 comments on commit 6dea928

Please sign in to comment.