8000 Deprecate ConstraintValidatorFactory::$validators and $container · symfony/symfony@e2f0107 · GitHub
[go: up one dir, main page]

Skip to content

Commit e2f0107

Browse files
committed
Deprecate ConstraintValidatorFactory::$validators and $container
1 parent 80f9480 commit e2f0107

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

UPGRADE-3.3.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ FrameworkBundle
6868
deprecated and will be removed in 4.0. Use the `Symfony\Component\Form\DependencyInjection\FormPass`
6969
class instead.
7070

71+
* The `ConstraintValidatorFactory::$validators` and `$container` properties
72+
have been deprecated and will be removed in 4.0.
73+
7174
HttpKernel
7275
-----------
7376

UPGRADE-4.0.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ FrameworkBundle
185185
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass` class has been
186186
removed. Use the `Symfony\Component\Form\DependencyInjection\FormPass` class instead.
187187

188+
* The `ConstraintValidatorFactory::$validators` and `$container` properties
189+
have been removed.
190+
188191
SecurityBundle
189192
--------------
190193

@@ -452,7 +455,7 @@ SecurityBundle
452455
--------------
453456

454457
* The `UserPasswordEncoderCommand` class does not allow `null` as the first argument anymore.
455-
458+
456459
* `UserPasswordEncoderCommand` does not implement `ContainerAwareInterface` anymore.
457460

458461
Workflow

src/Symfony/Bundle/FrameworkBundle/Validator/ConstraintValidatorFactory.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@
4040
*/
4141
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
4242
{
43+
/**
44+
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
45+
*/
4346
protected $container;
47+
48+
/**
49+
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
50+
*/
4451
protected $validators;
4552

4653
/**
@@ -89,4 +96,52 @@ public function getInstance(Constraint $constraint)
8996

9097
return $this->validators[$name];
9198
}
99+
100+
/**
101+
* @internal
102+
*/
103+
public function __get($name)
104+
{
105+
if ('validators' === $name || 'container' === $name) {
106+
@trigger_error(sprintf('Using the "%s::$%s" property is deprecated since version 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED);
107+
}
108+
109+
return $this->$name;
110+
}
111+
112+
/**
113+
* @internal
114+
*/
115+
public function __set($name, $value)
116+
{
117+
if ('validators' === $name || 'container' === $name) {
118+
@trigger_error(sprintf('Using the "%s::$%s" property is deprecated since version 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED);
119+
}
120+
121+
$this->$name = $value;
122+
}
123+
124+
/**
125+
* @internal
126+
*/
127+
public function __isset($name)
128+
{
129+
if ('validators' === $name || 'container' === $name) {
130+
@trigger_error(sprintf('Using the "%s::$%s" property is deprecated since version 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED);
131+
}
132+
133+
return isset($this->$name);
134+
}
135+
136+
/**
137+
* @internal
138+
*/
139+
public function __unset($name)
140+
{
141+
if ('validators' === $name || 'container' === $name) {
142+
@trigger_error(sprintf('Using the "%s::$%s" property is deprecated since version 3.3 as it will be removed/private in 4.0.', __CLASS__, $name), E_USER_DEPRECATED);
143+
}
144+
145+
unset($this->$name);
146+
}
92147
}

0 commit comments

Comments
 (0)
0