Skip to content

Commit 0be9470

Browse files
committed
feature #7199 Documented the compiler passes priorities (javiereguiluz)
This PR was squashed before being merged into the 3.2 branch (closes #7199). Discussion ---------- Documented the compiler passes priorities This fixes #6671. Commits ------- 6c96d38 Documented the compiler passes priorities
2 parents cebad3a + 6c96d38 commit 0be9470

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

components/dependency_injection/compilation.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,23 @@ been run, use::
423423
PassConfig::TYPE_AFTER_REMOVING
424424
);
425425

426+
.. versionadded:: 3.2
427+
The option to prioritize compiler passes was added in Symfony 3.2.
428+
429+
You can also control the order in which compiler passes are run for each
430+
compilation phase. Use the optional third argument of ``addCompilerPass()`` to
431+
set the priority as an integer number. The default priority is ``0`` and the higher
432+
its value, the earlier it's executed::
433+
434+
// ...
435+
// FirstPass is executed after SecondPass because its priority is lower
436+
$container->addCompilerPass(
437+
new FirstPass(), PassConfig::TYPE_AFTER_REMOVING, 10
438+
);
439+
$container->addCompilerPass(
440+
new SecondPass(), PassConfig::TYPE_AFTER_REMOVING, 30
441+
);
442+
426443
.. _components-dependency-injection-dumping:
427444

428445
Dumping the Configuration for Performance

0 commit comments

Comments
 (0)