Complete the removal of API versions in the validator component

Thanks to the PHP version requirement bump to 5.3.9+, the BC layer can
be available all the time.
This commit is contained in:
Christophe Coevoet 2015-03-22 16:12:19 +01:00
parent 75088c0adc
commit 9438206c25
66 changed files with 128 additions and 1567 deletions

View File

@ -763,8 +763,9 @@ class FrameworkExtension extends Extension
// You can use this parameter to check the API version in your own
// bundle extension classes
// This is set to 2.5-bc for compatibility with Symfony 2.5 and 2.6.
// @deprecated since version 2.7, to be removed in 3.0
$container->setParameter('validator.api', $config['api']);
$container->setParameter('validator.api', '2.5-bc');
}
private function getValidatorMappingFiles(ContainerBuilder $container)

View File

@ -153,7 +153,6 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
'static_method' => array('loadValidatorMetadata'),
'translation_domain' => 'validators',
'strict_email' => false,
'api' => '2.5-bc',
),
'annotations' => array(
'cache' => 'file',

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => '2.5',
),
));

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => '2.5-bc',
),
));

View File

@ -1,9 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
'api' => 'auto',
),
));

View File

@ -1,8 +0,0 @@
<?php
$container->loadFromExtension('framework', array(
'secret' => 's3cr3t',
'validation' => array(
'enabled' => true,
),
));

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="2.5" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="2.5-bc" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" api="auto" />
</framework:config>
</container>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:validation enabled="true" />
</framework:config>
</container>

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: 2.5

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: 2.5-bc

View File

@ -1,5 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true
api: auto

View File

@ -1,4 +0,0 @@
framework:
secret: s3cr3t
validation:
enabled: true

View File

@ -276,7 +276,7 @@ abstract class FrameworkExtensionTest extends TestCase
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(7, $calls);
$this->assertCount(6, $calls);
$this->assertSame('setConstraintValidatorFactory', $calls[0][0]);
$this->assertEquals(array(new Reference('validator.validator_factory')), $calls[0][1]);
$this->assertSame('setTranslator', $calls[1][0]);
@ -289,8 +289,6 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setMetadataCache', $calls[5][0]);
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
$this->assertSame('setApiVersion', $calls[6][0]);
$this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]);
}
/**
@ -337,7 +335,7 @@ abstract class FrameworkExtensionTest extends TestCase
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(7, $calls);
$this->assertCount(6, $calls);
$this->assertSame('enableAnnotationMapping', $calls[4][0]);
$this->assertEquals(array(new Reference('annotation_reader')), $calls[4][1]);
$this->assertSame('addMethodMapping', $calls[5][0]);
@ -355,7 +353,7 @@ abstract class FrameworkExtensionTest extends TestCase
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(8, $calls);
$this->assertCount(7, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addYamlMappings', $calls[4][0]);
$this->assertSame('enableAnnotationMapping', $calls[5][0]);
@ -378,79 +376,11 @@ abstract class FrameworkExtensionTest extends TestCase
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(5, $calls);
$this->assertCount(4, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
// no cache, no annotations, no static methods
}
public function testValidation2Dot5Api()
{
$container = $this->createContainerFromFile('validation_2_5_api');
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(6, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addMethodMapping', $calls[4][0]);
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setApiVersion', $calls[5][0]);
$this->assertSame(array(Validation::API_VERSION_2_5), $calls[5][1]);
$this->assertSame('Symfony\Component\Validator\Validator\ValidatorInterface', $container->getParameter('validator.class'));
// no cache, no annotations
}
public function testValidation2Dot5BcApi()
{
$container = $this->createContainerFromFile('validation_2_5_bc_api');
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(6, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addMethodMapping', $calls[4][0]);
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setApiVersion', $calls[5][0]);
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
$this->assertSame('Symfony\Component\Validator\ValidatorInterface', $container->getParameter('validator.class'));
// no cache, no annotations
}
public function testValidationImplicitApi()
{
$container = $this->createContainerFromFile('validation_implicit_api');
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(6, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addMethodMapping', $calls[4][0]);
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setApiVersion', $calls[5][0]);
// no cache, no annotations
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}
/**
* This feature is equivalent to the implicit api, only that the "api"
* key is explicitly set to "auto".
*/
public function testValidationAutoApi()
{
$container = $this->createContainerFromFile('validation_auto_api');
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
$this->assertCount(6, $calls);
$this->assertSame('addXmlMappings', $calls[3][0]);
$this->assertSame('addMethodMapping', $calls[4][0]);
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
$this->assertSame('setApiVersion', $calls[5][0]);
// no cache, no annotations
$this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]);
}
public function testFormsCanBeEnabledWithoutCsrfProtection()
{
$container = $this->createContainerFromFile('form_no_csrf');

View File

@ -14,13 +14,14 @@ namespace Symfony\Component\Validator\Context;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\ClassBasedInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\Exception\BadMethodCallException;
use Symfony\Component\Validator\Mapping\MetadataInterface;
use Symfony\Component\Validator\Mapping\PropertyMetadataInterface;
use Symfony\Component\Validator\Util\PropertyPath;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
use Symfony\Component\Validator\Violation\ConstraintViolationBuilder;
/**
@ -187,11 +188,17 @@ class ExecutionContext implements ExecutionContextInterface
// API, as they are not present in the new interface anymore.
// You should use buildViolation() instead.
if (func_num_args() > 2) {
throw new BadMethodCallException(
'The parameters $invalidValue, $plural and $code are '.
'not supported anymore as of Symfony 2.5. Please use '.
'buildViolation() instead or enable the legacy mode.'
);
trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
$this
->buildViolation($message, $parameters)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
$this->violations->add(new ConstraintViolation(
@ -310,10 +317,26 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
{
throw new BadMethodCallException(
'addViolationAt() is not supported anymore as of Symfony 2.5. '.
'Please use buildViolation() instead or enable the legacy mode.'
);
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
if (func_num_args() > 2) {
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->addViolation()
;
}
/**
@ -321,10 +344,37 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
{
throw new BadMethodCallException(
'validate() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() instead or enable the legacy mode.'
);
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
if (is_array($value)) {
// The $traverse flag is ignored for arrays
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
if ($traverse && $value instanceof \Traversable) {
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, null, $groups)
;
}
/**
@ -332,10 +382,14 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function validateValue($value, $constraints, $subPath = '', $groups = null)
{
throw new BadMethodCallException(
'validateValue() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() instead or enable the legacy mode.'
);
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::getValidator() method instead.', E_USER_DEPRECATED);
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraints, $groups)
;
}
/**
@ -343,11 +397,16 @@ class ExecutionContext implements ExecutionContextInterface
*/
public function getMetadataFactory()
{
throw new BadMethodCallException(
'getMetadataFactory() is not supported anymore as of Symfony 2.5. '.
'Please use getValidator() in combination with getMetadataFor() '.
'or hasMetadataFor() instead or enable the legacy mode.'
);
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
$validator = $this->getValidator();
if ($validator instanceof LegacyValidatorInterface) {
return $validator->getMetadataFactory();
}
// The ValidatorInterface extends from the deprecated MetadataFactoryInterface, so return it when we don't have the factory instance itself
return $validator;
}
/**

View File

@ -11,8 +11,9 @@
namespace Symfony\Component\Validator\Context;
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContext class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
@ -50,114 +51,4 @@ class LegacyExecutionContext extends ExecutionContext
$this->metadataFactory = $metadataFactory;
}
/**
* {@inheritdoc}
*/
public function addViolation($message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
{
if (func_num_args() > 2) {
trigger_error('The parameters $invalidValue, $plural and $code in method '.__METHOD__.' are deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
$this
->buildViolation($message, $parameters)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
parent::addViolation($message, $parameters);
}
/**
* {@inheritdoc}
*/
public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::buildViolation method instead.', E_USER_DEPRECATED);
if (func_num_args() > 2) {
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->setInvalidValue($invalidValue)
->setPlural($plural)
->setCode($code)
->addViolation()
;
return;
}
$this
->buildViolation($message, $parameters)
->atPath($subPath)
->addViolation()
;
}
/**
* {@inheritdoc}
*/
public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false)
{
if (is_array($value)) {
// The $traverse flag is ignored for arrays
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
if ($traverse && $value instanceof \Traversable) {
$constraint = new Valid(array('traverse' => true, 'deep' => $deep));
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraint, $groups)
;
}
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, null, $groups)
;
}
/**
* {@inheritdoc}
*/
public function validateValue($value, $constraints, $subPath = '', $groups = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the '.__CLASS__.'::validate method instead.', E_USER_DEPRECATED);
return $this
->getValidator()
->inContext($this)
->atPath($subPath)
->validate($value, $constraints, $groups)
;
}
/**
* {@inheritdoc}
*/
public function getMetadataFactory()
{
trigger_error('The '.__METHOD__.' is deprecated since version 2.5 and will be removed in 3.0. Use the new Symfony\Component\Validator\Context\ExecutionContext::getValidator method in combination with Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
return $this->metadataFactory;
}
}

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Validator\Context;
trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;

View File

@ -21,7 +21,6 @@ use Symfony\Component\Validator\Context\LegacyExecutionContext;
use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\PropertyMetadata;
use Symfony\Component\Validator\Tests\Fixtures\StubGlobalExecutionContext;
use Symfony\Component\Validator\Validation;
/**
@ -303,7 +302,10 @@ abstract class AbstractConstraintValidatorTest extends \PHPUnit_Framework_TestCa
return new ConstraintViolationAssertion($this->context, $message, $this->constraint);
}
abstract protected function getApiVersion();
protected function getApiVersion()
{
return Validation::API_VERSION_2_5;
}
abstract protected function createValidator();
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyAllValidatorLegacyApiTest extends AllValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyBlankValidatorLegacyApiTest extends BlankValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyCallbackValidatorLegacyApiTest extends CallbackValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyCardSchemeValidatorLegacyApiTest extends CardSchemeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyChoiceValidatorLegacyApiTest extends ChoiceValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @group legacy
*/
class LegacyCollectionValidatorArrayLegacyApiTest extends CollectionValidatorArrayTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @group legacy
*/
class LegacyCollectionValidatorArrayObjectLegacyApiTest extends CollectionValidatorArrayObjectTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,25 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @group legacy
*/
class LegacyCollectionValidatorCustomArrayObjectLegacyApiTest extends CollectionValidatorCustomArrayObjectTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyCountValidatorArrayLegacyApiTest extends CountValidatorArrayTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyCountValidatorCountableLegacyApiTest extends CountValidatorCountableTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyCurrencyValidatorLegacyApiTest extends CurrencyValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyDateTimeValidatorLegacyApiTest extends DateTimeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyDateValidatorLegacyApiTest extends DateValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyEmailValidatorLegacyApiTest extends EmailValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyEqualToValidatorLegacyApiTest extends EqualToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyExpressionValidatorLegacyApiTest extends ExpressionValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyFalseValidatorLegacyApiTest extends FalseValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyFileValidatorObjectLegacyApiTest extends FileValidatorObjectTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyFileValidatorPathLegacyApiTest extends FileValidatorPathTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyGreaterThanOrEqualValidatorLegacyApiTest extends GreaterThanOrEqualValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyGreaterThanValidatorLegacyApiTest extends GreaterThanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyIbanValidatorLegacyApiTest extends IbanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyIdenticalToValidatorLegacyApiTest extends IdenticalToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyImageValidatorLegacyApiTest extends ImageValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyIpValidatorLegacyApiTest extends IpValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyIsbnValidatorLegacyApiTest extends IsbnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyIssnValidatorLegacyApiTest extends IssnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLanguageValidatorLegacyApiTest extends LanguageValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLengthValidatorLegacyApiTest extends LengthValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLessThanOrEqualValidatorLegacyApiTest extends LessThanOrEqualValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLessThanValidatorLegacyApiTest extends LessThanValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLocaleValidatorLegacyApiTest extends LocaleValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyLuhnValidatorLegacyApiTest extends LuhnValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotBlankValidatorLegacyApiTest extends NotBlankValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotEqualToValidatorLegacyApiTest extends NotEqualToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotIdenticalToValidatorLegacyApiTest extends NotIdenticalToValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyNotNullValidatorLegacyApiTest extends NotNullValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyNullValidatorLegacyApiTest extends NullValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyRangeValidatorLegacyApiTest extends RangeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyRegexValidatorLegacyApiTest extends RegexValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyTimeValidatorLegacyApiTest extends TimeValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyTrueValidatorLegacyApiTest extends TrueValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyTypeValidatorLegacyApiTest extends TypeValidatorTest
{
protected static $file;
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyUrlValidatorLegacyApiTest extends UrlValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Validation;
/**
* @since 2.5.3
* @author Bernhard Schussek <bschussek@gmail.com>
* @group legacy
*/
class LegacyUuidValidatorLegacyApiTest extends UuidValidatorTest
{
protected function getApiVersion()
{
return Validation::API_VERSION_2_5_BC;
}
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
trigger_error('The '.__NAMESPACE__.'\LegacyValidator class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
/**
* A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+.
@ -24,26 +24,6 @@ use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
*
* @deprecated since version 2.5, to be removed in 3.0.
*/
class LegacyValidator extends RecursiveValidator implements LegacyValidatorInterface
class LegacyValidator extends RecursiveValidator
{
public function validate($value, $groups = null, $traverse = false, $deep = false)
{
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
return parent::validate($value, false, $groups, $traverse, $deep);
}
public function validateValue($value, $constraints, $groups = null)
{
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
return parent::validate($value, $constraints, $groups);
}
public function getMetadataFactory()
{
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
return $this->metadataFactory;
}
}

View File

@ -19,6 +19,7 @@ use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\ObjectInitializerInterface;
use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface;
/**
* Recursive implementation of {@link ValidatorInterface}.
@ -26,7 +27,7 @@ use Symfony\Component\Validator\ObjectInitializerInterface;
* @since 2.5
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class RecursiveValidator implements ValidatorInterface
class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface
{
/**
* @var ExecutionContextFactoryInterface
@ -113,22 +114,19 @@ class RecursiveValidator implements ValidatorInterface
/**
* {@inheritdoc}
*/
public function validate($value, $constraints = null, $groups = null)
public function validate($value, $groups = null, $traverse = false, $deep = false)
{
// The following code must be removed in 3.0
$numArgs = func_num_args();
if ($numArgs > 3) {
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
$traverse = func_get_arg(3);
$deep = func_get_arg(4);
$constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep));
if (self::testConstraints($groups)) {
if ((!$traverse && !$deep) || self::testGroups($traverse)) {
$constraints = $groups;
$groups = $traverse;
}
}
// Use new signature if constraints are given in the second argument
if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) {
// Rename to avoid total confusion ;)
$constraints = $groups;
$groups = $traverse;
} else {
trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
$constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep));
}
return $this->startContext($value)
@ -158,18 +156,30 @@ class RecursiveValidator implements ValidatorInterface
}
/**
* @internal
* @deprecated since version 2.5, to be removed in 3.0.
* {@inheritdoc}
*/
public function validateValue($value, $constraints, $groups = null)
{
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED);
return $this->validate($value, $constraints, $groups);
}
/**
* {@inheritdoc}
*/
public function getMetadataFactory()
{
trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.', E_USER_DEPRECATED);
return $this->metadataFactory;
}
private static function testConstraints($constraints)
{
return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint);
}
/**
* @internal
* @deprecated since version 2.5, to be removed in 3.0.
*/
private static function testGroups($groups)
{
return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (is_string(current($groups)) || current($groups) instanceof GroupSequence));