Skip to content

[Service Container] Add documentation for CheckAliasValidityPass #19622

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1035,20 +1035,22 @@ to them.
Linting Service Definitions
---------------------------

The ``lint:container`` command checks that the arguments injected into services
match their type declarations. It's useful to run it before deploying your
The ``lint:container`` command makes several checks into your services definition. It first
checks that when an alias is defined on an interface it can resolve to a service implementing this
interface (thus preventing type errors at runtime). It then checks that the arguments injected
into services match their type declarations. It's useful to run it before deploying your
application to production (e.g. in your continuous integration server):

.. code-block:: terminal

$ php bin/console lint:container

Checking the types of all service arguments whenever the container is compiled
can hurt performance. That's why this type checking is implemented in a
:doc:`compiler pass </service_container/compiler_passes>` called
``CheckTypeDeclarationsPass`` which is disabled by default and enabled only when
executing the ``lint:container`` command. If you don't mind the performance
loss, enable the compiler pass in your application.
Having these checks on all aliases and service arguments whenever the container is compiled
can hurt performance. That's why these checks are implemented in dedicated
:doc:`compiler passes </service_container/compiler_passes>` respectively called
``CheckAliasValidityPass`` and ``CheckTypeDeclarationsPass`` which are disabled by default and
enabled only when executing the ``lint:container`` command. If you don't mind the performance
loss, enable these compiler passes in your application.

.. _container-public:

Expand Down