Skip to content

Commit

Permalink
Add Symfony 7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
steevanb committed May 24, 2024
1 parent 39acb86 commit dda1151
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion bridge/Symfony/Normalizer/ObjectCollectionDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ class ObjectCollectionDenormalizer implements DenormalizerInterface, Denormalize
{
use DenormalizerAwareTrait;

public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
return
is_subclass_of($type, AbstractObjectCollection::class)
|| is_subclass_of($type, AbstractObjectNullableCollection::class);
}

public function getSupportedTypes(?string $format): array
{
return [
AbstractObjectCollection::class => false,
AbstractObjectNullableCollection::class => false
];
}

/**
* @param array<mixed> $context
* @return AbstractObjectCollection<object>|AbstractObjectNullableCollection<object|null>
Expand Down
14 changes: 13 additions & 1 deletion bridge/Symfony/Normalizer/ScalarCollectionDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class ScalarCollectionDenormalizer implements DenormalizerInterface
{
public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
return in_array(
$type,
Expand All @@ -33,6 +33,18 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
);
}

public function getSupportedTypes(?string $format): array
{
return [
FloatCollection::class => false,
FloatNullableCollection::class => false,
IntegerCollection::class => false,
IntegerNullableCollection::class => false,
StringCollection::class => false,
StringNullableCollection::class => false
];
}

/**
* @param array<mixed> $context
* @return CollectionInterface<float|integer|string|null>
Expand Down

0 comments on commit dda1151

Please sign in to comment.