Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored and github-actions[bot] committed Nov 13, 2024
1 parent cb882f7 commit 8fb97bb
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/DependencyInjection/SonataIntlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private function validateTimezones(array $timezones): void
try {
new \DateTimeZone($timezone);
} catch (\Exception) {
throw new \RuntimeException(sprintf(
throw new \RuntimeException(\sprintf(
'Unknown timezone "%s". Please check your sonata_intl configuration.',
$timezone
));
Expand Down
4 changes: 2 additions & 2 deletions src/Helper/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ protected static function checkInternalClass(mixed $instance, string $class, arr

$messages = [];
foreach ($args as $name => $value) {
$messages[] = sprintf('%s => %s', $name, $value);
$messages[] = \sprintf('%s => %s', $name, $value);
}

throw new \RuntimeException(sprintf(
throw new \RuntimeException(\sprintf(
'Unable to create internal class: %s, with params: %s',
$class,
implode(', ', $messages)
Expand Down
12 changes: 6 additions & 6 deletions src/Helper/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class DateTimeFormatter extends BaseHelper implements DateTimeFormatterInt
public function __construct(
private TimezoneDetectorInterface $timezoneDetector,
string $charset,
?string $defaultLocale = null
?string $defaultLocale = null,
) {
parent::__construct($charset, $defaultLocale);
}
Expand All @@ -41,7 +41,7 @@ public function formatDate(
\DateTimeInterface|string|int $date,
?string $locale = null,
?string $timezone = null,
?int $dateType = null
?int $dateType = null,
): string {
$date = $this->getDatetime($date, $timezone);

Expand All @@ -61,7 +61,7 @@ public function formatDateTime(
?string $locale = null,
?string $timezone = null,
?int $dateType = null,
?int $timeType = null
?int $timeType = null,
): string {
$date = $this->getDatetime($datetime, $timezone);

Expand All @@ -80,7 +80,7 @@ public function formatTime(
\DateTimeInterface|string|int $time,
?string $locale = null,
?string $timezone = null,
?int $timeType = null
?int $timeType = null,
): string {
$date = $this->getDatetime($time, $timezone);

Expand All @@ -99,7 +99,7 @@ public function format(
\DateTimeInterface|string|int $datetime,
string $pattern,
?string $locale = null,
?string $timezone = null
?string $timezone = null,
): string {
$date = $this->getDatetime($datetime, $timezone);

Expand All @@ -117,7 +117,7 @@ public function format(

public function getDatetime(
\DateTimeInterface|string|int $data,
?string $timezone = null
?string $timezone = null,
): \DateTimeInterface {
if ($data instanceof \DateTimeInterface) {
return $data;
Expand Down
10 changes: 5 additions & 5 deletions src/Helper/DateTimeFormatterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function formatDate(
\DateTimeInterface|string|int $date,
?string $locale = null,
?string $timezone = null,
?int $dateType = null
?int $dateType = null,
): string;

/**
Expand All @@ -45,7 +45,7 @@ public function formatDateTime(
?string $locale = null,
?string $timezone = null,
?int $dateType = null,
?int $timeType = null
?int $timeType = null,
): string;

/**
Expand All @@ -57,7 +57,7 @@ public function formatTime(
\DateTimeInterface|string|int $time,
?string $locale = null,
?string $timezone = null,
?int $timeType = null
?int $timeType = null,
): string;

/**
Expand All @@ -67,7 +67,7 @@ public function format(
\DateTimeInterface|string|int $datetime,
string $pattern,
?string $locale = null,
?string $timezone = null
?string $timezone = null,
): string;

/**
Expand All @@ -77,6 +77,6 @@ public function format(
*/
public function getDatetime(
\DateTimeInterface|string|int $data,
?string $timezone = null
?string $timezone = null,
): \DateTimeInterface;
}
8 changes: 4 additions & 4 deletions src/Helper/NumberFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
private array $attributes = [],
private array $textAttributes = [],
private array $symbols = [],
?string $defaultLocale = null
?string $defaultLocale = null,
) {
parent::__construct($charset, $defaultLocale);
}
Expand Down Expand Up @@ -65,7 +65,7 @@ public function formatCurrency(string|float|int $number, string $currency, array
$result = $formatter->formatCurrency($number, $currency);
if (false === $result) {
throw new \InvalidArgumentException(
sprintf('Cannot format the value %s with the currency %s.', $number, $currency)
\sprintf('Cannot format the value %s with the currency %s.', $number, $currency)
);
}

Expand All @@ -89,7 +89,7 @@ public function format(string|float|int $number, int $style, array $attributes =

$result = $formatter->format($number);
if (false === $result) {
throw new \InvalidArgumentException(sprintf('Cannot format the value %s', $number));
throw new \InvalidArgumentException(\sprintf('Cannot format the value %s', $number));
}

return $this->fixCharset($result);
Expand Down Expand Up @@ -167,7 +167,7 @@ private function parseConstantValue(string $attribute): int
$constantName = 'NumberFormatter::'.$attribute;

if (!\defined($constantName)) {
throw new \InvalidArgumentException(sprintf('NumberFormatter has no constant "%s".', $attribute));
throw new \InvalidArgumentException(\sprintf('NumberFormatter has no constant "%s".', $attribute));
}

return \constant($constantName);
Expand Down
6 changes: 3 additions & 3 deletions src/Twig/DateTimeRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function formatDate(
?string $pattern = null,
?string $locale = null,
?string $timezone = null,
?int $dateType = null
?int $dateType = null,
): string {
if (null !== $pattern) {
return $this->helper->format($date, $pattern, $locale, $timezone);
Expand All @@ -47,7 +47,7 @@ public function formatTime(
?string $pattern = null,
?string $locale = null,
?string $timezone = null,
?int $timeType = null
?int $timeType = null,
): string {
if (null !== $pattern) {
return $this->helper->format($time, $pattern, $locale, $timezone);
Expand All @@ -65,7 +65,7 @@ public function formatDatetime(
?string $locale = null,
?string $timezone = null,
?int $dateType = null,
?int $timeType = null
?int $timeType = null,
): string {
if (null !== $pattern) {
return $this->helper->format($time, $pattern, $locale, $timezone);
Expand Down
14 changes: 7 additions & 7 deletions src/Twig/NumberRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function formatCurrency(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatCurrency($number, $currency, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -61,7 +61,7 @@ public function formatDecimal(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatDecimal($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -82,7 +82,7 @@ public function formatScientific(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatScientific($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -103,7 +103,7 @@ public function formatSpellout(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatSpellout($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -124,7 +124,7 @@ public function formatPercent(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatPercent($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -145,7 +145,7 @@ public function formatDuration(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatDuration($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand All @@ -166,7 +166,7 @@ public function formatOrdinal(
array $attributes = [],
array $textAttributes = [],
array $symbols = [],
?string $locale = null
?string $locale = null,
): string {
return $this->helper->formatOrdinal($number, $attributes, $textAttributes, $symbols, $locale);
}
Expand Down
10 changes: 5 additions & 5 deletions tests/Twig/Extension/NumberRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testFormatCurrency(
string $currency,
array $attributes = [],
array $textAttributes = [],
array $symbols = []
array $symbols = [],
): void {
$helper = new NumberFormatter('UTF-8');
$helper->setLocale('en');
Expand Down Expand Up @@ -86,7 +86,7 @@ public function testFormatDecimal(
string|float|int $number,
array $attributes = [],
array $textAttributes = [],
array $symbols = []
array $symbols = [],
): void {
$helper = new NumberFormatter('UTF-8');
$helper->setLocale('en');
Expand Down Expand Up @@ -133,7 +133,7 @@ public function testFormatScientific(
string|float|int $number,
array $attributes = [],
array $textAttributes = [],
array $symbols = []
array $symbols = [],
): void {
$helper = new NumberFormatter('UTF-8');
$helper->setLocale('en');
Expand Down Expand Up @@ -177,7 +177,7 @@ public function testFormatDuration(
string|float|int $number,
array $attributes = [],
array $textAttributes = [],
array $symbols = []
array $symbols = [],
): void {
$helper = new NumberFormatter('UTF-8');
$helper->setLocale('en');
Expand Down Expand Up @@ -209,7 +209,7 @@ public function testFormatPercent(
string|float|int $number,
array $attributes = [],
array $textAttributes = [],
array $symbols = []
array $symbols = [],
): void {
$helper = new NumberFormatter('UTF-8');
$helper->setLocale('en');
Expand Down

0 comments on commit 8fb97bb

Please sign in to comment.