Skip to content

Commit

Permalink
Fix BC break in AbstractItemNormalizer introduced in v2.4
Browse files Browse the repository at this point in the history
Implementing additional interfaces (ContextAwareNormalizerInterface and ContextAwareDenormalizerInterface)
in an abstract class is a BC break
  • Loading branch information
teohhanhui committed May 21, 2019
1 parent 79c3a65 commit 9156bc3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/GraphQl/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ final class ItemNormalizer extends BaseItemNormalizer
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = []): bool
public function supportsNormalization($data, $format = null): bool
{
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
return self::FORMAT === $format && parent::supportsNormalization($data, $format);
}

/**
Expand Down Expand Up @@ -71,9 +71,9 @@ protected function normalizeCollectionOfRelations(PropertyMetadata $propertyMeta
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
public function supportsDenormalization($data, $type, $format = null): bool
{
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context);
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Hal/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ final class ItemNormalizer extends AbstractItemNormalizer
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = []): bool
public function supportsNormalization($data, $format = null): bool
{
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
return self::FORMAT === $format && parent::supportsNormalization($data, $format);
}

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
public function supportsDenormalization($data, $type, $format = null): bool
{
// prevent the use of lower priority normalizers (e.g. serializer.normalizer.object) for this format
return self::FORMAT === $format;
Expand Down
8 changes: 4 additions & 4 deletions src/JsonApi/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = []): bool
public function supportsNormalization($data, $format = null): bool
{
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
return self::FORMAT === $format && parent::supportsNormalization($data, $format);
}

/**
Expand Down Expand Up @@ -118,9 +118,9 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
public function supportsDenormalization($data, $type, $format = null): bool
{
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context);
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/JsonLd/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function __construct(ResourceMetadataFactoryInterface $resourceMetadataFa
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = []): bool
public function supportsNormalization($data, $format = null): bool
{
return self::FORMAT === $format && parent::supportsNormalization($data, $format, $context);
return self::FORMAT === $format && parent::supportsNormalization($data, $format);
}

/**
Expand Down Expand Up @@ -93,9 +93,9 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
public function supportsDenormalization($data, $type, $format = null): bool
{
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format, $context);
return self::FORMAT === $format && parent::supportsDenormalization($data, $type, $format);
}

/**
Expand Down
8 changes: 3 additions & 5 deletions src/Serializer/AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

Expand All @@ -47,7 +45,7 @@
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
abstract class AbstractItemNormalizer extends AbstractObjectNormalizer implements ContextAwareNormalizerInterface, ContextAwareDenormalizerInterface
abstract class AbstractItemNormalizer extends AbstractObjectNormalizer
{
use ClassInfoTrait;
use ContextTrait;
Expand Down Expand Up @@ -90,7 +88,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null, array $context = [])
public function supportsNormalization($data, $format = null)
{
if (!\is_object($data) || $data instanceof \Traversable) {
return false;
Expand Down Expand Up @@ -161,7 +159,7 @@ public function normalize($object, $format = null, array $context = [])
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = null, array $context = [])
public function supportsDenormalization($data, $type, $format = null)
{
return $this->localCache[$type] ?? $this->localCache[$type] = $this->resourceClassResolver->isResourceClass($type);
}
Expand Down

0 comments on commit 9156bc3

Please sign in to comment.