Skip to content

Commit

Permalink
moar normalizer compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Oct 28, 2024
1 parent a1d4e02 commit 511bbe5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Normalizer/FieldItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function normalize($field_item, $format = NULL, array $context = []): arr
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed {

if (!isset($context['target_instance'])) {
throw new InvalidArgumentException('$context[\'target_instance\'] must be set to denormalize with the FieldItemNormalizer');
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/FieldNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function normalize($field, $format = NULL, array $context = []): array|bo
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed {

if (!isset($context['target_instance'])) {
throw new InvalidArgumentException('$context[\'target_instance\'] must be set to denormalize with the FieldNormalizer');
Expand Down
2 changes: 1 addition & 1 deletion src/Normalizer/FileEntityNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function normalize($entity, $format = NULL, array $context = []): array|b
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed {

$file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody();

Expand Down
4 changes: 2 additions & 2 deletions src/Normalizer/NormalizerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ abstract class NormalizerBase extends SerializationNormalizerBase implements Den
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
public function supportsNormalization(mixed $data, ?string $format = NULL, array $context = []): bool {

return in_array($format, $this->formats) && parent::supportsNormalization($data, $format);
}

/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool {
public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []): bool {

if (in_array($format, $this->formats) && (class_exists($this->supportedInterfaceOrClass) || interface_exists($this->supportedInterfaceOrClass))) {
$target = new \ReflectionClass($type);
Expand Down

0 comments on commit 511bbe5

Please sign in to comment.