Skip to content

feat(state)!: drop TranslatorInterface support from DeserializeProvider - #8514

Merged
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/state-drop-translator-from-deserialize-provider
Sep 11, 2026
Merged

feat(state)!: drop TranslatorInterface support from DeserializeProvider#8514
soyuka merged 2 commits into
api-platform:mainfrom
Maxcastel:feat/state-drop-translator-from-deserialize-provider

Conversation

@Maxcastel

Copy link
Copy Markdown
Contributor
Q A
Branch? main
Tickets #8211
License MIT
Doc PR api-platform/docs#...

Removes the TranslatorInterface constructor argument of DeserializeProvider, as announced by the 4.4 deprecation:

Passing a "Symfony\Contracts\Translation\TranslatorInterface" to "ApiPlatform\State\Provider\DeserializeProvider" is deprecated and will be removed in 5.0. Translation is now handled by "DenormalizationViolationFactoryInterface".

Before

new DeserializeProvider(
    $decorated,
    $serializer,
    $serializerContextBuilder,
    $translator, // removed
    $violationFactory,
);

After

new DeserializeProvider(
    $decorated,
    $serializer,
    $serializerContextBuilder,
    $violationFactory, // was the fifth argument
);

Changes

  • DeserializeProvider: drops the parameter, the deprecation and the import
  • api_platform.state_provider.deserialize (both the state/provider.php and symfony/events.php definitions) drop the null placeholder
  • api_platform.mcp.state_provider.deserialize was passing service('translator'), so API Platform triggered its own deprecation at runtime whenever a translator was available; the argument is gone
  • Laravel's ApiPlatformProvider drops the null placeholder
  • api-platform/state no longer requires symfony/translation-contracts: DeserializeProvider was its only consumer in the component

BC break

Anyone instantiating DeserializeProvider directly, or replacing the api_platform.state_provider.deserialize service definition, must drop the translator argument. Passing a translator in the fourth position now passes it where a DenormalizationViolationFactoryInterface is expected and raises a TypeError.

@soyuka
soyuka merged commit ce741c8 into api-platform:main Sep 11, 2026
8 of 107 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants