8000 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass by GuilhemN · Pull Request #21730 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DependencyInjection] Use a service locator in AddConstraintValidatorsPass #21730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[DependencyInjection] Deprecate ConstraintValidatorFactory::$validato…
…rs and $container
  • Loading branch information
GuilhemN committed Mar 1, 2017
commit 1088d62ed708e1ba4e17224c6f2e5c98975ee92e
3 changes: 3 additions & 0 deletions UPGRADE-3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ FrameworkBundle
deprecated and will be removed in 4.0. Use the `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass`
class instead.

* The `ConstraintValidatorFactory::$validators` and `$container` properties
have been deprecated and will be removed in 4.0.

HttpKernel
-----------

Expand Down
7 changes: 5 additions & 2 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ FrameworkBundle
removed. Use the `Symfony\Component\PropertyInfo\DependencyInjection\PropertyInfoPass`
class instead.

* The `ConstraintValidatorFactory::$validators` and `$container` properties
have been removed.

HttpFoundation
---------------

Expand Down Expand Up @@ -243,7 +246,7 @@ HttpKernel

* The `Psr6CacheClearer::addPool()` method has been removed. Pass an array of pools indexed
by name to the constru 10000 ctor instead.

* The `LazyLoadingFragmentHandler::addRendererService()` method has been removed.

* The `X-Status-Code` header method of setting a custom status code in the
Expand Down Expand Up @@ -310,7 +313,7 @@ Translation
TwigBundle
----------

* The `ContainerAwareRuntimeLoader` class has been removed. Use the
* The `ContainerAwareRuntimeLoader` class has been removed. Use the
Twig `Twig_ContainerRuntimeLoader` class instead.

TwigBridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
*/
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
{
/**
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
*/
protected $container;

/**
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
*/
protected $validators;

/**
Expand Down Expand Up @@ -85,4 +92,52 @@ public function getInstance(Constraint $constraint)

return $this->validators[$name];
}

/**
* @internal
*/
public function __get($name)
{
if ('validators' === $name || 'container' === $name) {
@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);
}

return $this->$name;
}

/**
* @internal
*/
public function __set($name, $value)
{
if ('validators' === $name || 'container' === $name) {
@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);
}

$this->$name = $value;
}

/**
* @internal
*/
public function __isset($name)
{
if ('validators' === $name || 'container' === $name) {
@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);
}

return isset($this->$name);
}

/**
* @internal
*/
public function __unset($name)
{
if ('validators' === $name || 'container' === $name) {
@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);
}

unset($this->$name);
}
}
0