Skip to content

Commit 30c111d

Browse files
committed
Upgrade PHPStan
- Allow throw exceptions for invalid return types
1 parent befaeb6 commit 30c111d

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"ergebnis/composer-normalize": "^2.25",
4747
"jetbrains/phpstorm-attributes": "^1.0",
4848
"phpmd/phpmd": "^2.12",
49-
"phpstan/phpstan": "^1.5",
49+
"phpstan/phpstan": "^1.7",
5050
"phpunit/phpunit": "^9.5"
5151
},
5252
"minimum-stability": "dev",

src/Language.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function addLines(string $locale, string $file, array $lines) : static
134134
*/
135135
public function currency(float $value, string $currency, string $locale = null) : string
136136
{
137+
// @phpstan-ignore-next-line
137138
return \NumberFormatter::create(
138139
$locale ?? $this->getCurrentLocale(),
139140
\NumberFormatter::CURRENCY
@@ -157,7 +158,8 @@ public function date(int $time, string $style = null, string $locale = null) : s
157158
throw new InvalidArgumentException('Invalid date style format: ' . $style);
158159
}
159160
$style = $style ?: 'short';
160-
return (string) \MessageFormatter::formatMessage(
161+
// @phpstan-ignore-next-line
162+
return \MessageFormatter::formatMessage(
161163
$locale ?? $this->getCurrentLocale(),
162164
"{time, date, {$style}}",
163165
['time' => $time]
@@ -394,7 +396,8 @@ public function lang(string $line, array $args = [], string $locale = null) : ?s
394396
*/
395397
public function ordinal(int $number, string $locale = null) : string
396398
{
397-
return (string) \MessageFormatter::formatMessage(
399+
// @phpstan-ignore-next-line
400+
return \MessageFormatter::formatMessage(
398401
$locale ?? $this->getCurrentLocale(),
399402
'{number, ordinal}',
400403
['number' => $number]

0 commit comments

Comments
 (0)