Skip to content

Commit 72de9df

Browse files
committed
[Serializer] Rename CacheableSupportsMethodInterface to SupportsVaryInterface
1 parent 0998710 commit 72de9df

15 files changed

+62
-59
lines changed

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
4.1.0
55
-----
66

7-
* added `CacheableSupportsMethodInterface` for normalizers and denormalizers that use
7+
* added `SupportsVaryInterface` for normalizers and denormalizers that use
88
only the type and the format in their `supports*()` methods
99
* added `MissingConstructorArgumentsException` new exception for deserialization failure
1010
of objects that needs data insertion in constructor

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @author Kévin Dunglas <dunglas@gmail.com>
2929
*/
30-
abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface
30+
abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, SupportsVaryInterface
3131
{
3232
use ObjectToPopulateTrait;
3333
use SerializerAwareTrait;
@@ -150,9 +150,9 @@ public function setIgnoredAttributes(array $ignoredAttributes)
150150
/**
151151
* {@inheritdoc}
152152
*/
153-
public function hasCacheableSupportsMethod(): bool
153+
public function isSupportsVaryByData(): bool
154154
{
155-
return false;
155+
return true;
156156
}
157157

158158
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
* @final
2626
*/
27-
class ArrayDenormalizer implements ContextAwareDenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface
27+
class ArrayDenormalizer implements ContextAwareDenormalizerInterface, SerializerAwareInterface, SupportsVaryInterface
2828
{
2929
/**
3030
* @var SerializerInterface|DenormalizerInterface
@@ -87,8 +87,8 @@ public function setSerializer(SerializerInterface $serializer)
8787
/**
8888
* {@inheritdoc}
8989
*/
90-
public function hasCacheableSupportsMethod(): bool
90+
public function isSupportsVaryByData(): bool
9191
{
92-
return $this->serializer instanceof CacheableSupportsMethodInterface && $this->serializer->hasCacheableSupportsMethod();
92+
return !$this->serializer instanceof SupportsVaryInterface || $this->serializer->isSupportsVaryByData();
9393
}
9494
}

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

Lines changed: 0 additions & 26 deletions
This file was deleted.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @author Grégoire Pineau <lyrixx@lyrixx.info>
2323
* @author Kévin Dunglas <dunglas@gmail.com>
2424
*/
25-
class ConstraintViolationListNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface
25+
class ConstraintViolationListNormalizer implements NormalizerInterface, SupportsVaryInterface
2626
{
2727
/**
2828
* {@inheritdoc}
@@ -60,8 +60,8 @@ public function supportsNormalization($data, $format = null)
6060
/**
6161
* {@inheritdoc}
6262
*/
63-
public function hasCacheableSupportsMethod(): bool
63+
public function isSupportsVaryByData(): bool
6464
{
65-
return __CLASS__ === \get_class($this);
65+
return __CLASS__ !== \get_class($this);
6666
}
6767
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* @author Jordi Boggiano <j.boggiano@seld.be>
1919
*/
20-
class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, CacheableSupportsMethodInterface
20+
class CustomNormalizer implements NormalizerInterface, DenormalizerInterface, SerializerAwareInterface, SupportsVaryInterface
2121
{
2222
use ObjectToPopulateTrait;
2323
use SerializerAwareTrait;
@@ -71,8 +71,8 @@ public function supportsDenormalization($data, $type, $format = null)
7171
/**
7272
* {@inheritdoc}
7373
*/
74-
public function hasCacheableSupportsMethod(): bool
74+
public function isSupportsVaryByData(): bool
7575
{
76-
return __CLASS__ === \get_class($this);
76+
return __CLASS__ !== \get_class($this);
7777
}
7878
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @author Kévin Dunglas <dunglas@gmail.com>
2525
*/
26-
class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
26+
class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface, SupportsVaryInterface
2727
{
2828
private static $supportedTypes = array(
2929
\SplFileInfo::class => true,
@@ -122,9 +122,9 @@ public function supportsDenormalization($data, $type, $format = null)
122122
/**
123123
* {@inheritdoc}
124124
*/
125-
public function hasCacheableSupportsMethod(): bool
125+
public function isSupportsVaryByData(): bool
126126
{
127-
return __CLASS__ === \get_class($this);
127+
return __CLASS__ !== \get_class($this);
128128
}
129129

130130
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Jérôme Parmentier <jerome@prmntr.me>
2222
*/
23-
class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
23+
class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterface, SupportsVaryInterface
2424
{
2525
const FORMAT_KEY = 'dateinterval_format';
2626

@@ -58,9 +58,9 @@ public function supportsNormalization($data, $format = null)
5858
/**
5959
* {@inheritdoc}
6060
*/
61-
public function hasCacheableSupportsMethod(): bool
61+
public function isSupportsVaryByData(): bool
6262
{
63-
return __CLASS__ === \get_class($this);
63+
return __CLASS__ !== \get_class($this);
6464
}
6565

6666
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @author Kévin Dunglas <dunglas@gmail.com>
2222
*/
23-
class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
23+
class DateTimeNormalizer implements NormalizerInterface, DenormalizerInterface, SupportsVaryInterface
2424
{
2525
const FORMAT_KEY = 'datetime_format';
2626
const TIMEZONE_KEY = 'datetime_timezone';
@@ -119,9 +119,9 @@ public function supportsDenormalization($data, $type, $format = null)
119119
/**
120120
* {@inheritdoc}
121121
*/
122-
public function hasCacheableSupportsMethod(): bool
122+
public function isSupportsVaryByData(): bool
123123
{
124-
return __CLASS__ === \get_class($this);
124+
return __CLASS__ !== \get_class($this);
125125
}
126126

127127
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public function supportsDenormalization($data, $type, $format = null)
5555
/**
5656
* {@inheritdoc}
5757
*/
58-
public function hasCacheableSupportsMethod(): bool
58+
public function isSupportsVaryByData(): bool
5959
{
60-
return __CLASS__ === \get_class($this);
60+
return __CLASS__ !== \get_class($this);
6161
}
6262

6363
/**

0 commit comments

Comments
 (0)