bug #20415 [DI][Serializer] Add missing deprecations (nicolas-grekas)
This PR was merged into the 3.2-dev branch.
Discussion
----------
[DI][Serializer] Add missing deprecations
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
90ba197
[DI][Serializer] Add missing deprecations
This commit is contained in:
commit
5bd3a000d8
@ -70,12 +70,18 @@ class Compiler
|
||||
* @param string $type The type of the pass
|
||||
* @param int $priority Used to sort the passes
|
||||
*/
|
||||
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/**, $priority = 0*/)
|
||||
public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
|
||||
{
|
||||
// For BC
|
||||
if (func_num_args() >= 3) {
|
||||
$priority = func_get_arg(2);
|
||||
} else {
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
$priority = 0;
|
||||
}
|
||||
|
||||
|
@ -96,10 +96,16 @@ class PassConfig
|
||||
*/
|
||||
public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
|
||||
{
|
||||
// For BC
|
||||
if (func_num_args() >= 3) {
|
||||
$priority = func_get_arg(2);
|
||||
} else {
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
$priority = 0;
|
||||
}
|
||||
|
||||
|
@ -310,9 +310,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*
|
||||
* @return ContainerBuilder The current instance
|
||||
*/
|
||||
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/**, $priority = 0*/)
|
||||
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, $priority = 0*/)
|
||||
{
|
||||
// For BC
|
||||
if (func_num_args() >= 3) {
|
||||
$priority = func_get_arg(2);
|
||||
} else {
|
||||
|
@ -289,7 +289,18 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
|
||||
*/
|
||||
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, $format = null*/)
|
||||
{
|
||||
$format = func_num_args() >= 6 ? func_get_arg(5) : null;
|
||||
if (func_num_args() >= 6) {
|
||||
$format = func_get_arg(5);
|
||||
} else {
|
||||
if (__CLASS__ !== get_class($this)) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
||||
@trigger_error(sprintf('Method %s() will have a 6th `$format = null` argument in version 4.0. Not defining it is deprecated since 3.2.', get_class($this), __FUNCTION__), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
$format = null;
|
||||
}
|
||||
|
||||
if (
|
||||
isset($context[static::OBJECT_TO_POPULATE]) &&
|
||||
|
@ -59,9 +59,9 @@ class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer
|
||||
return in_array($attribute, array('foo', 'baz'));
|
||||
}
|
||||
|
||||
public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes)
|
||||
public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, $format = null)
|
||||
{
|
||||
return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes);
|
||||
return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user