8000 apply fabbpot.io patch · symfony/symfony@7744b34 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7744b34

Browse files
committed
apply fabbpot.io patch
1 parent b0eb741 commit 7744b34

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/Symfony/Component/Serializer/Normalizer/DateIntervalNormalizer.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public function __construct(array $defaultContext = [])
3434
}
3535

3636
/**
37-
* {@inheritdoc}
38-
*
3937
* @return string
4038
*
4139
* @throws InvalidArgumentException
@@ -49,25 +47,17 @@ public function normalize($object, string $format = null, array $context = [])
4947
return $object->form 8000 at($context[self::FORMAT_KEY] ?? $this->defaultContext[self::FORMAT_KEY]);
5048
}
5149

52-
/**
53-
* {@inheritdoc}
54-
*/
5550
public function supportsNormalization($data, string $format = null)
5651
{
5752
return $data instanceof \DateInterval;
5853
}
5954

60-
/**
61-
* {@inheritdoc}
62-
*/
6355
public function hasCacheableSupportsMethod(): bool
6456
{
6557
return __CLASS__ === static::class;
6658
}
6759

6860
/**
69-
* {@inheritdoc}
70-
*
7161
* @return \DateInterval
7262
*
7363
* @throws NotNormalizableValueException
@@ -118,17 +108,14 @@ public function denormalize($data, string $type, string $format = null, array $c
118108
}
119109
}
120110

121-
/**
122-
* {@inheritdoc}
123-
*/
124111
public function supportsDenormalization($data, string $type, string $format = null)
125112
{
126113
return \DateInterval::class === $type;
127114
}
128115

129116
private function isISO8601(string $string): bool
130117
{
131-
if (PHP_VERSION_ID >= 80000) {
118+
if (\PHP_VERSION_ID >= 80000) {
132119
return preg_match('/^[\-+]?P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:\d+W|%[wW]W)?(?:\d+D|%[dD]D)?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
133120
}
134121

src/Symfony/Component/Serializer/Tests/Normalizer/DateIntervalNormalizerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public function testDenormalizeIntervalsWithOmittedPartsBeingZero()
123123
* Since PHP 8.0 DateInterval::construct supports periods containing both D and W period designators.
124124
*
125125
* @requires PHP 8
126+
*
126127
* @testWith ["%rP%yY%mM%wW%dDT%hH%iM%sS","P3W2D", 23]
127128
*/
128129
public function testDenormalizeIntervalWithBothWeeksAndDays(string $format, string $input, int $expectedDays)

0 commit comments

Comments
 (0)
0