Skip to content

Commit

Permalink
[serializer] fix serializer for Symfony 6 (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov committed Oct 29, 2022
1 parent b7f1102 commit 07b9e39
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface DenormalizerInterface
{
/**
* @template TObject of object
* @template TType of string|class-string<TObject>
* @psalm-param mixed $data
* @psalm-param TType $type
* @psalm-return (TType is class-string<TObject> ? TObject : mixed)
*/
public function denormalize($data, string $type, string $format = null, array $context = []);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Symfony\Component\Serializer\Normalizer;

interface DenormalizerInterface
{
/**
* @template TObject of object
* @template TType of string|class-string<TObject>
* @psalm-param mixed $data
* @psalm-param TType $type
* @psalm-return (TType is class-string<TObject> ? TObject : mixed)
*/
public function denormalize($data, string $type, string $format = null, array $context = []);
}
15 changes: 15 additions & 0 deletions src/Stubs/5/Component/Serializer/SerializerInterface.stubphp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Symfony\Component\Serializer;

interface SerializerInterface
{
/**
* @template TObject of object
* @template TType of string|class-string<TObject>
* @psalm-param mixed $data
* @psalm-param TType $type
* @psalm-return (TType is class-string<TObject> ? TObject : mixed)
*/
public function deserialize($data, string $type, string $format, array $context = []);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ Feature: Serializer interface
final class Serializer implements SerializerInterface
{
public function serialize($data, string $format, array $context = []): string
public function serialize(mixed $data, string $format, array $context = []): string
{
return '';
}
public function deserialize($data, string $type, string $format, array $context = []): mixed
public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed
{
return [];
}
Expand Down

0 comments on commit 07b9e39

Please sign in to comment.