New in Symfony 3.3: Dependency Injection deprecations

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

Deprecated dumping an uncompiled container

Contributed by
Roland Franssen
in #20634.

The service container in Symfony applications is usually configured with YAML and XML files, but it's dumped into PHP before the application execution to improve its performance.

Compiling and dumping the container is a rather complex process and in Symfony 3.3 we've simplified it a bit by deprecating the dumping of uncompiled containers. This change won't impact you unless using the stand-alone DependencyInjection component.

Deprecated the DefinitionDecorator class

Contributed by
Christian Flothmann
in #20663.

The Symfony\Component\DependencyInjection\DefinitionDecorator class is confusing because it has nothing to do with service decoration. This class is used to reflect a parent-child-relationship between definitions.

In Symfony 3.3, to avoid any confusion, this class has been deprecated and renamed to Symfony\Component\DependencyInjection\ChildDefinition.

Deprecated the case-insensitivity of service identifiers

Contributed by
Nicolas Grekas
in #21223.

Service identifiers in Symfony applications are case insensitive. This means that if your service id is app.UserManager, you can inject or get that service as app.usermanager, APP.userMANAGER, aPp.UsErMaNaGeR, etc.

In Symfony 3.3 we've deprecated this behavior and service identifiers are no longer case-insensitive. You must inject or get the services using the exact same identifier used in the config files.

In addition to being more correct, removing this feature in Symfony 4.0 will unlock other potential optimizations in the DependencyInjection component code.

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.

New in Symfony 3.3: Dependency Injection deprecations

Tweet this


Thank's for this improvement.
Awesome, `DefinitionDecorator`has always confused me! :)
You just made me learn that services definitions are case insensitive, and I'm glad they will become case sensitive in 4.0 :D

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.