Skip to content

Commit 6b56df1

Browse files
committed
Update the CI
1 parent f4ccde6 commit 6b56df1

4 files changed

Lines changed: 27 additions & 5 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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class AbsoluteDateTranslatable implements TranslatableInterface
2525

2626
public function __construct(
2727
AbsoluteDate $absoluteDate,
28-
int $dateType = IntlDateFormatter::SHORT,
29-
string $pattern = ''
28+
int $dateType = IntlDateFormatter::SHORT,
29+
string $pattern = ''
3030
) {
3131
$this->absoluteDate = $absoluteDate;
3232
$this->dateType = $dateType;
@@ -54,7 +54,11 @@ public function trans(TranslatorInterface $translator, string $locale = null): s
5454
if (false !== strpos($locale, '_US')) {
5555
//A more used format
5656
$pattern = self::$formatters[$key]->getPattern();
57-
$pattern = str_replace(['yy', 'M', 'd'], ['y', 'MM', 'dd'], $pattern);
57+
$pattern = str_replace(
58+
['yy', 'M', 'd'],
59+
['y', 'MM', 'dd'],
60+
$pattern !== false ? $pattern : AbsoluteDate::DEFAULT_DATE_FORMAT
61+
);
5862
self::$formatters[$key]->setPattern($pattern);
5963
}
6064
}

0 commit comments

Comments
 (0)