X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fhal%2Fsrc%2FNormalizer%2FNormalizerBase.php;h=8b18985b8b46adc40593e6958159693fc85cac2a;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=43a5a07161f5d3db4387b73289557898a0575f1e;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/hal/src/Normalizer/NormalizerBase.php b/web/core/modules/hal/src/Normalizer/NormalizerBase.php index 43a5a0716..8b18985b8 100644 --- a/web/core/modules/hal/src/Normalizer/NormalizerBase.php +++ b/web/core/modules/hal/src/Normalizer/NormalizerBase.php @@ -10,36 +10,22 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; */ abstract class NormalizerBase extends SerializationNormalizerBase implements DenormalizerInterface { - /** - * The formats that the Normalizer can handle. - * - * @var array - */ - protected $formats = ['hal_json']; - /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = NULL) { - return in_array($format, $this->formats) && parent::supportsNormalization($data, $format); - } + protected $format = ['hal_json']; /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = NULL) { - if (in_array($format, $this->formats) && (class_exists($this->supportedInterfaceOrClass) || interface_exists($this->supportedInterfaceOrClass))) { - $target = new \ReflectionClass($type); - $supported = new \ReflectionClass($this->supportedInterfaceOrClass); - if ($supported->isInterface()) { - return $target->implementsInterface($this->supportedInterfaceOrClass); - } - else { - return ($target->getName() == $this->supportedInterfaceOrClass || $target->isSubclassOf($this->supportedInterfaceOrClass)); - } + protected function checkFormat($format = NULL) { + if (isset($this->formats)) { + @trigger_error('::formats is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Use ::$format instead. See https://www.drupal.org/node/2868275', E_USER_DEPRECATED); + + $this->format = $this->formats; } - return FALSE; + return parent::checkFormat($format); } }