8000 [DependencyInjection] Deprecate ConstraintValidatorFactory::$validato… · symfony/symfony@9ccdeac · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ccdeac

Browse files
committed
[DependencyInjection] Deprecate ConstraintValidatorFactory::$validators and $container
1 parent 518d02d commit 9ccdeac

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

UPGRADE-3.3.md

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

74+
* The `ConstraintValidatorFactory::$validators` and `$container` properties
75+
have been deprecated and will be removed in 4.0.
76+
7477
HttpKernel
7578
-----------
7679

UPGRADE-4.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ FrameworkBundle
188188
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass` class has been
189189
removed. Use the `Symfony\Component\Form\DependencyInjection\FormPass` class instead.
190190

191+
* The `ConstraintValidatorFactory::$validators` and `$container` properties
192+
have been removed.
193+
191194
HttpFoundation
192195
---------------
193196

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
/**
@@ -85,4 +92,52 @@ public function getInstance(Constraint $constraint)
8592

8693
return $this->validators[$name];
8794
}
95+
96+
/**
97+
* @internal
98+
*/
99+
public function __get($name)
100+
{
101+
if ('validators' === $name || 'container' === $name) {
102+
@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);
103+
}
104+
105+
return $this->$name;
106+
}
107+
108+
/**
109+
* @internal
110+
*/
111+
public function __set($name, $value)
112+
{
113+
if ('validators' === $name || 'container' === $name) {
114+
@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);
115+
}
116+
117+
$this->$name = $value;
118+
}
119+
120+
/**
121+
* @internal
122+
*/
123+
public function __isset($name)
124+
{
125+
if ('validators' === $name || 'container' === $name) {
126+
@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);
127+
}
128+
129+
return isset($this->$name);
130+
}
131+
132+
/**
133+
* @internal
134+
*/
135+
public function __unset($name)
136+
{
137+
if ('validators' === $name || 'container' === $name) {
138+
@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);
139+
}
140+
141+
unset($this->$name);
142+
}
88143
}

0 commit comments

Comments
 (0)
0