symfony/symfony — pull request #12151 by peterrehm (2014-10-06 13:38:15+00:00)
Title: [Framework][DX] Set the proper validator class according to the configured api version

| Q | A
| ------------- | ---
| Bug fix? | [yes]
| New feature? | [no]
| BC breaks? | [no]
| Deprecations? | [no]
| Tests pass? | [yes]
| Fixed tickets | -
| License | MIT
| Doc PR | -

With this change the proper validator class will be dumped and therefore used for code completion in IDE's like PhpStorm which rely on the dumped container.

If you have 2.4 or 2.5-bc API the class will be

Symfony\Component\Validator\ValidatorInterface

If you use the 2.5 API the class will be

Symfony\Component\Validator\Validator\ValidatorInterface

I consider this also as important for the developer experience since a wrong type hint can easily cause issues since the method signatures of the validate() method have changed.

From

````php
public function validate($value, $groups = null, $traverse = false, $deep = false);
````

To

````php
public function validate($value, $constraints = null, $groups = null);
````

So if you want to validate specific groups you now have to pass them as the third argument instead of the second.