Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Serializer] Add a more global interface with all method implement by the implemantation #43325

Copy link
Copy link
Closed
@lyrixx

Description

@lyrixx
Issue body actions

It's very common in a service to inject the normalizer, and to use normalize() or denormalize()
However, theses methods does not exist on SerializerInterface.

So, if we want to use normalize(), denormalize(), and serializer,we need to inject 3 services: NormalizerInterface, DenormalizerInterface, and SerializerInterface. Not really handy !

To be honest, I always inject the SerializerInterface, because I know methods exists on the implementations. But on every projects, I have to ignore error reported by static analysis.

So, what do you think of creating an interface that embrace all three others?


Side question, with PHP 8.1 we have intersection types, how does behave the containers with the following signature

public function __construct(NormalizerInterface&DenormalizerInterface&SerializerInterface $serializer) ? 

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)Serializer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.