Skip to content

Commit 534ff73

Browse files
committed
minor #20410 [DI] Add missing deprecation in ContainerBuilder::addCompilerPass (nicolas-grekas)
This PR was merged into the 3.2-dev branch. Discussion ---------- [DI] Add missing deprecation in ContainerBuilder::addCompilerPass | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18022 | License | MIT | Doc PR | - ping @Ener-Getick Commits ------- c0e880e [DI] Add missing deprecation in ContainerBuilder::addCompilerPass
2 parents 2484e70 + ee86986 commit 534ff73

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ContainerBuilder.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig:
316316
if (func_num_args() >= 3) {
317317
$priority = func_get_arg(2);
318318
} else {
319+
if (__CLASS__ !== get_class($this)) {
320+
$r = new \ReflectionMethod($this, __FUNCTION__);
321+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
322+
@trigger_error(sprintf('Method %s() will have a third `$priority = 0` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
323+
}
324+
}
325+
319326
$priority = 0;
320327
}
321328

0 commit comments

Comments
 (0)