Skip to content

[DX] bin/console debug:container --tag serializer.normalizer not sorted by priority even though it's very relevent #45396

Closed
@dkarlovi

Description

@dkarlovi

Symfony version(s) affected

5.4

Description

When debugging the serializer, the order of normalizers is very important. The configuration takes the priority attribute into account when injecting them.

But, the priority is not used to sort the debug info here, meaning you can't read the list top to bottom and understand the normalizers order used. This is a DX bug.

How to reproduce

Run

$ bin/console debug:container --tag serializer.normalizer

  serializer.normalizer.constraint_violation_list   -915       Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer  
  serializer.normalizer.datetimezone                -915       Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer             
  serializer.normalizer.dateinterval                -915       Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer             
  serializer.normalizer.data_uri                    -920       Symfony\Component\Serializer\Normalizer\DataUriNormalizer                  
  serializer.normalizer.datetime                    -910       Symfony\Component\Serializer\Normalizer\DateTimeNormalizer                 
  serializer.normalizer.json_serializable           -900       Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer         
  serializer.normalizer.problem                     -890       Symfony\Component\Serializer\Normalizer\ProblemNormalizer                  
  serializer.normalizer.uid                         -890       Symfony\Component\Serializer\Normalizer\UidNormalizer                      
  serializer.normalizer.form_error                  -915       Symfony\Component\Serializer\Normalizer\FormErrorNormalizer                
  serializer.normalizer.object                      -1000      Symfony\Component\Serializer\Normalizer\ObjectNormalizer                   
  serializer.denormalizer.array                     -990       Symfony\Component\Serializer\Normalizer\ArrayDenormalizer     

Possible Solution

Sort the --tags list by priority by default. Not sure if only for specific tags, but it should reflect the order the container will find the services in.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDXDX = Developer eXperience (anything that improves the experience of using Symfony)Good first issueIdeal for your first contribution! (some Symfony experience may be required)Status: Needs Review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions