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

[PropertyInfo][Serializer] Add support of list and trigger deprecation when filling a list-typed property with an array #49056

Open
wants to merge 1 commit into
base: 6.3
Choose a base branch
from

Conversation

alexandre-daubois
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? yes
Tickets Fix #48887
License MIT
Doc PR Todo

As this improvement could break existing code, I went for the deprecation triggering way.

Reproducer:

class TestCommand extends Command
{
    // ...

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        dump($this->serializer->deserialize(<<<JSON
          {
            "list": {
              "test": 1,
              "2": 2
            }
          }
JSON, Foo::class, 'json'));

        return Command::SUCCESS;
    }
}

class Foo
{
    /**
     * @var list<string>
     */
    public array $list;
}

Results on:

image

@alexandre-daubois alexandre-daubois requested a review from dunglas as a code owner Jan 21, 2023
@carsonbot carsonbot added this to the 6.3 milestone Jan 21, 2023
@carsonbot carsonbot changed the title [Serializer][PropertyInfo] Add support of list and trigger deprecation when filling a list-typed property with an array [PropertyInfo][Serializer] Add support of list and trigger deprecation when filling a list-typed property with an array Jan 21, 2023
…ion when filling a list-typed property with an array
@alexandre-daubois alexandre-daubois force-pushed the propertyinfo-serializer-lists branch from f6826e9 to e01dfd6 Compare Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serializer/PropertyInfo treats list<Type> as Type[] and does not enforce sequential indexes
2 participants