Skip to content

Commit efd4363

Browse files
[DI][Serializer] Add missing deprecations
1 parent 534ff73 commit efd4363

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Compiler/Compiler.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,18 @@ public function getLoggingFormatter()
7070
* @param string $type The type of the pass
7171
* @param int $priority Used to sort the passes
7272
*/
73-
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/**, $priority = 0*/)
73+
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
7474
{
75-
// For BC
7675
if (func_num_args() >= 3) {
7776
$priority = func_get_arg(2);
7877
} else {
78+
if (__CLASS__ !== get_class($this)) {
79+
$r = new \ReflectionMethod($this, __FUNCTION__);
80+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
81+
@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);
82+
}
83+
}
84+
7985
$priority = 0;
8086
}
8187

Compiler/PassConfig.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,16 @@ public function getPasses()
9696
*/
9797
public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
9898
{
99-
// For BC
10099
if (func_num_args() >= 3) {
101100
$priority = func_get_arg(2);
102101
} else {
102+
if (__CLASS__ !== get_class($this)) {
103+
$r = new \ReflectionMethod($this, __FUNCTION__);
104+
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
105+
@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);
106+
}
107+
}
108+
103109
$priority = 0;
104110
}
105111

ContainerBuilder.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,8 @@ public function loadFromExtension($extension, array $values = array())
310310
*
311311
* @return ContainerBuilder The current instance
312312
*/
313-
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/**, $priority = 0*/)
313+
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
314314
{
315-
// For BC
316315
if (func_num_args() >= 3) {
317316
$priority = func_get_arg(2);
318317
} else {

0 commit comments

Comments
 (0)