Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[serializer] fix serializer for Symfony 6 #282

Merged
merged 2 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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