Skip to content

Commit 4ae9300

Browse files
committed
Update the CI
1 parent f4ccde6 commit 4ae9300

4 files changed

Lines changed: 29 additions & 6 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"symfony/contracts": "^2.4",
1818
"symfony/translation": "^6.0|^7.0",
1919
"assoconnect/php-quality-config": "^1.9",
20-
"assoconnect/validator-bundle": "^2.19"
20+
"assoconnect/validator-bundle": "^2.19",
21+
"rector/rector": "^1.2"
2122
},
2223
"require": {
2324
"ext-intl": "*",

rector.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
7+
return RectorConfig::configure()
8+
->withPaths([
9+
__DIR__ . '/src',
10+
__DIR__ . '/tests',
11+
])
12+
// uncomment to reach your current PHP version
13+
// ->withPhpSets()
14+
->withTypeCoverageLevel(0)
15+
->withSets([
16+
__DIR__ . '/vendor/assoconnect/php-quality-config/src/Rector/rules.php',
17+
]);

src/Normalizer/AbsoluteDateNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function supportsDenormalization(
7878
}
7979

8080
/**
81-
* @return non-empty-array<class-string, true>
81+
* @return array<'*', bool>
8282
*/
8383
public function getSupportedTypes(?string $format): array
8484
{

src/Translatable/AbsoluteDateTranslatable.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ class AbsoluteDateTranslatable implements TranslatableInterface
2525

2626
public function __construct(
2727
AbsoluteDate $absoluteDate,
28-
int $dateType = IntlDateFormatter::SHORT,
29-
string $pattern = ''
30-
) {
28+
int $dateType = IntlDateFormatter::SHORT,
29+
string $pattern = ''
30+
)
31+
{
3132
$this->absoluteDate = $absoluteDate;
3233
$this->dateType = $dateType;
3334
$this->pattern = $pattern;
@@ -54,7 +55,11 @@ public function trans(TranslatorInterface $translator, string $locale = null): s
5455
if (false !== strpos($locale, '_US')) {
5556
//A more used format
5657
$pattern = self::$formatters[$key]->getPattern();
57-
$pattern = str_replace(['yy', 'M', 'd'], ['y', 'MM', 'dd'], $pattern);
58+
$pattern = str_replace(
59+
['yy', 'M', 'd'],
60+
['y', 'MM', 'dd'],
61+
$pattern !== false ? $pattern : AbsoluteDate::DEFAULT_DATE_FORMAT
62+
);
5863
self::$formatters[$key]->setPattern($pattern);
5964
}
6065
}

0 commit comments

Comments
 (0)