Skip to content

Commit

Permalink
cs-fixer fix and phpstan analyse
Browse files Browse the repository at this point in the history
  • Loading branch information
JoMessina committed Jun 13, 2024
1 parent 8e9e6e9 commit 753125d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct($name)
);
}

private function compile(string $date, string|null $format = null): string
private function compile(string $date, ?string $format = null): string
{
if (null === $format) {
return sprintf('new \DateTimeImmutable(%s, new \DateTimeZone("UTC"))', $date);
Expand All @@ -26,7 +26,7 @@ private function compile(string $date, string|null $format = null): string
return sprintf('\DateTimeImmutable::createFromFormat(%s, %s, new \DateTimeZone("UTC"))', $date, $format);
}

private function evaluate(array $context, string $date, string|null $format = null): \DateTimeInterface
private function evaluate(array $context, string $date, ?string $format = null): \DateTimeInterface
{
if (null === $format) {
return new \DateTimeImmutable($date, new \DateTimeZone('UTC'));
Expand Down
4 changes: 2 additions & 2 deletions src/DateTimeZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct($name)
);
}

private function compile(string $date, string $zone, string|null $format = null): string
private function compile(string $date, string $zone, ?string $format = null): string
{
if (null === $format) {
return sprintf('new \DateTimeImmutable(%s, new \DateTimeZone(%s))', $date, $zone);
Expand All @@ -26,7 +26,7 @@ private function compile(string $date, string $zone, string|null $format = null)
return sprintf('\DateTimeImmutable::createFromFormat(%s, %s, new \DateTimeZone(%s))', $date, $format, $zone);
}

private function evaluate(array $context, string $date, string $zone, string|null $format = null): \DateTimeInterface
private function evaluate(array $context, string $date, string $zone, ?string $format = null): \DateTimeInterface
{
if (null === $format) {
return new \DateTimeImmutable($date, new \DateTimeZone($zone));
Expand Down
2 changes: 1 addition & 1 deletion src/FormatMetric.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private function compile($attribute, $locale): string
PHP;
}

private function evaluate(array $context, array $attribut, string $locale): string|null
private function evaluate(array $context, array $attribut, string $locale): ?string
{
return !\is_array($attribut)
|| !\array_key_exists('amount', $attribut) || !\array_key_exists('unit', $attribut) ? null : (function ($unit, $amount, $locale) {
Expand Down
2 changes: 1 addition & 1 deletion src/MetricAmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private function compile(string $value, int $decimalRound = 4): string
PATTERN;
}

private function evaluate(array $context, array $value, int $decimalRound): float|null
private function evaluate(array $context, array $value, int $decimalRound): ?float
{
return !\is_array($value) || !\array_key_exists('amount', $value) ? null : round((float) $value['amount'], $decimalRound);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MetricUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private function compile(string $value): string
PATTERN;
}

private function evaluate(array $context, array $value): string|null
private function evaluate(array $context, array $value): ?string
{
return !\is_array($value) || !\array_key_exists('unit', $value) ? null : $value['unit'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/WithMultipleOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function (string \$code) use(\$input) {
/**
* @return array<int, array<string, array|string|null>>
*/
private function evaluate(array $context, array $codes, string $attribute, array $labels, string|null $locale = null, string|null $scope = null): array
private function evaluate(array $context, array $codes, string $attribute, array $labels, ?string $locale = null, ?string $scope = null): array
{
return [[
'locale' => $locale,
Expand Down
2 changes: 1 addition & 1 deletion src/WithProductValueMediaFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private function compile(string $code, string $attribute, string $locale = 'null
}

/**
* @return array<int, string>
* @return array<string, string>
*/
private function evaluate(array $context, string $code, string $attribute, string $locale = 'null', string $scope = 'null'): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/WithReferenceEntitySimpleOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private function compile(string $code, string $locale = 'null', string $channel
PHP;
}

private function evaluate(array $context, string $code, string|null $locale = null, string|null $channel = null): array
private function evaluate(array $context, string $code, ?string $locale = null, ?string $channel = null): array
{
return [[
'locale' => $locale,
Expand Down
2 changes: 1 addition & 1 deletion src/WithReferenceEntityValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private function compile(string $value, string $locale = 'null', string $channel
return sprintf('([["data" => (%s), "locale" => (%s), "channel" => (%s)]])', $value, $locale, $channel);
}

private function evaluate(array $context, string $value, string|null $locale = null, string|null $channel = null): array
private function evaluate(array $context, string $value, ?string $locale = null, ?string $channel = null): array
{
return [[
'locale' => $locale,
Expand Down

0 comments on commit 753125d

Please sign in to comment.