# New in Symfony 8.2: Generics and Stricter Types in the Serializer

DevFeed: [New in Symfony 8.2: Generics and Stricter Types in the Serializer](<https://devfeed.tech/articles/new-in-symfony-8-2-generics-and-stricter-types-in-the-serializer-102321.md>)

Original publisher: [Read original article](<https://symfony.com/blog/new-in-symfony-8-2-generics-and-stricter-types-in-the-serializer>)

Author: Javier Eguiluz

Published: 2026-10-27T08:12:00Z

Content type: release

Language: en

Sources: [Symfony](<https://devfeed.tech/sources/symfony-blog.md>)

Topics: [Symfony](<https://devfeed.tech/topics/symfony.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>), [Programming Language Type Systems](<https://devfeed.tech/topics/programming-language-type-systems.md>), [Data validation](<https://devfeed.tech/topics/data-validation.md>), [typesafety](<https://devfeed.tech/topics/typesafety.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [collections](<https://devfeed.tech/tags/collections.md>), [generics](<https://devfeed.tech/tags/generics.md>), [json](<https://devfeed.tech/tags/json.md>), [phpdoc](<https://devfeed.tech/tags/phpdoc.md>), [symfony](<https://devfeed.tech/tags/symfony.md>), [types](<https://devfeed.tech/tags/types.md>), [union-types](<https://devfeed.tech/tags/union-types.md>)

## AI overview

Symfony 8.2 improves Serializer denormalization by resolving PHPDoc generic types from the property that holds a generic object, so nested values such as `Page<Product>` items become `Product` instances. This requires PropertyInfo's `PhpStanExtractor` and `phpstan/phpdoc-parser`; the target class name alone does not supply template types. It also denormalizes union-typed collection elements and throws when an element matches no union member or a key violates its key type. A JSON object supplied for `list<string>` still works in 8.2 but triggers a deprecation and will throw `NotNormalizableValueException` in 9.0; use a JSON array for a list, or an array type that permits meaningful keys. TypeInfo adds covariant-template support, `Type::map()` for replacing nested types, and `Type::getMismatches()` for paths and expected/actual types. Because mismatch reporting does more work, call it after `accepts()` returns false.

## Source excerpt

The Serializer component relies on the TypeInfo component to know the type of each property it denormalizes. Symfony 8.2 makes both components understand more of the types you already write in your PHPDoc, such as generics and arrays of union types, and makes...