From de3b2b615cfe36de79033dce925545e75315b6b3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 29 Nov 2016 13:19:51 +0100 Subject: [PATCH 1/2] Documented the compiler passes priorities --- components/dependency_injection/compilation.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 01c1bb6d60f..4fa9edff8dc 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -423,6 +423,22 @@ been run, use:: PassConfig::TYPE_AFTER_REMOVING ); +.. versionadded:: 3.2 + The option to prioritize compiler passes was added in Symfony 3.2. + +You can also control the order in which compiler passes are run for each +compilation phase. Use the optional third argument of ``addCompilerPass()`` to +set the priority (the higher the number, the earlier it's executed):: + + // ... + // FirstPass is executed after SecondPass because its priority is lower + $container->addCompilerPass( + new FirstPass(), PassConfig::TYPE_AFTER_REMOVING, 10 + ); + $container->addCompilerPass( + new SecondPass(), PassConfig::TYPE_AFTER_REMOVING, 30 + ); + .. _components-dependency-injection-dumping: Dumping the Configuration for Performance From dd5d95adc88d455a2834f5afe52ac464b8d6aed3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 29 Nov 2016 16:25:36 +0100 Subject: [PATCH 2/2] Mentioned that 0 is the default priority --- components/dependency_injection/compilation.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 4fa9edff8dc..3ced7ab4db5 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -428,7 +428,8 @@ been run, use:: You can also control the order in which compiler passes are run for each compilation phase. Use the optional third argument of ``addCompilerPass()`` to -set the priority (the higher the number, the earlier it's executed):: +set the priority as an integer number. The default priority is ``0`` and the higher +its value, the earlier it's executed:: // ... // FirstPass is executed after SecondPass because its priority is lower