From e3ef8c2aaf89edca56904e2df3fcfabab1df4bd1 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Fri, 20 Mar 2015 22:38:06 +0900 Subject: [PATCH 1/6] [Validator] added Japanese translation for unmatched charset (id: 80) --- Resources/translations/validators.ja.xlf | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Resources/translations/validators.ja.xlf b/Resources/translations/validators.ja.xlf index 62f4c9043..63eecc0e1 100644 --- a/Resources/translations/validators.ja.xlf +++ b/Resources/translations/validators.ja.xlf @@ -278,6 +278,38 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. {{ compared_value_type }}としての{{ compared_value }}と等しくてはいけません。 + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + 画像のアスペクト比が大きすぎます({{ ratio }})。{{ max_ratio }}までにしてください。 + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + 画像のアスペクト比が小さすぎます({{ ratio }})。{{ min_ratio }}以上にしてください。 + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + 画像が正方形になっています({{ width }}x{{ height }}ピクセル)。正方形の画像は許可されていません。 + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + 画像が横向きになっています({{ width }}x{{ height }}ピクセル)。横向きの画像は許可されていません。 + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + 画像が縦向きになっています({{ width }}x{{ height }}ピクセル)。縦向きの画像は許可されていません。 + + + An empty file is not allowed. + 空のファイルは許可されていません。 + + + The host could not be resolved. + ホストを解決できませんでした。 + + + This value does not match the expected {{ charset }} charset. + この値は予期される文字コード({{ charset }})と異なります。 + From 1f7b7f1455cd52a5255836623538bee19434f52a Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Sat, 21 Mar 2015 11:51:07 +0100 Subject: [PATCH 2/6] CS: Convert double quotes to single quotes --- Constraints/EmailValidator.php | 2 +- Constraints/IssnValidator.php | 2 +- Tests/Constraints/CollectionTest.php | 16 ++++++++-------- Tests/Constraints/LengthValidatorTest.php | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Constraints/EmailValidator.php b/Constraints/EmailValidator.php index b3789a130..f3a25bdb1 100644 --- a/Constraints/EmailValidator.php +++ b/Constraints/EmailValidator.php @@ -77,6 +77,6 @@ private function checkMX($host) */ private function checkHost($host) { - return $this->checkMX($host) || (checkdnsrr($host, "A") || checkdnsrr($host, "AAAA")); + return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')); } } diff --git a/Constraints/IssnValidator.php b/Constraints/IssnValidator.php index 24618eac5..8d9609fa3 100644 --- a/Constraints/IssnValidator.php +++ b/Constraints/IssnValidator.php @@ -42,7 +42,7 @@ public function validate($value, Constraint $constraint) // Compose regex pattern $digitsPattern = $constraint->requireHyphen ? '\d{4}-\d{3}' : '\d{4}-?\d{3}'; $checkSumPattern = $constraint->caseSensitive ? '[\d|X]' : '[\d|X|x]'; - $pattern = "/^".$digitsPattern.$checkSumPattern."$/"; + $pattern = '/^'.$digitsPattern.$checkSumPattern.'$/'; if (!preg_match($pattern, $value)) { $this->context->addViolation($constraint->message, array( diff --git a/Tests/Constraints/CollectionTest.php b/Tests/Constraints/CollectionTest.php index 4b485a9b1..79f50b0b5 100644 --- a/Tests/Constraints/CollectionTest.php +++ b/Tests/Constraints/CollectionTest.php @@ -75,16 +75,16 @@ public function testRejectValidConstraintWithinRequired() public function testAcceptOptionalConstraintAsOneElementArray() { $collection1 = new Collection(array( - "fields" => array( - "alternate_email" => array( + 'fields' => array( + 'alternate_email' => array( new Optional(new Email()), ), ), )); $collection2 = new Collection(array( - "fields" => array( - "alternate_email" => new Optional(new Email()), + 'fields' => array( + 'alternate_email' => new Optional(new Email()), ), )); @@ -94,16 +94,16 @@ public function testAcceptOptionalConstraintAsOneElementArray() public function testAcceptRequiredConstraintAsOneElementArray() { $collection1 = new Collection(array( - "fields" => array( - "alternate_email" => array( + 'fields' => array( + 'alternate_email' => array( new Required(new Email()), ), ), )); $collection2 = new Collection(array( - "fields" => array( - "alternate_email" => new Required(new Email()), + 'fields' => array( + 'alternate_email' => new Required(new Email()), ), )); diff --git a/Tests/Constraints/LengthValidatorTest.php b/Tests/Constraints/LengthValidatorTest.php index 6147e424f..6f4481839 100644 --- a/Tests/Constraints/LengthValidatorTest.php +++ b/Tests/Constraints/LengthValidatorTest.php @@ -96,10 +96,10 @@ public function getOneCharset() } return array( - array("é", "utf8", true), - array("\xE9", "CP1252", true), - array("\xE9", "XXX", false), - array("\xE9", "utf8", false), + array('é', 'utf8', true), + array("\xE9", 'CP1252', true), + array("\xE9", 'XXX', false), + array("\xE9", 'utf8', false), ); } From 2b6050f10a7288028dd112f754170f77b777b281 Mon Sep 17 00:00:00 2001 From: sarah khalil Date: Mon, 19 Jan 2015 18:16:09 +0100 Subject: [PATCH 3/6] Removed 2.5 bc layer --- Tests/ValidatorBuilderTest.php | 4 ++-- Validator/LegacyValidator.php | 28 +----------------------- Validator/RecursiveValidator.php | 37 ++++++++++++++++++++++++++++++++ ValidatorBuilder.php | 12 ++--------- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/Tests/ValidatorBuilderTest.php b/Tests/ValidatorBuilderTest.php index af20f9cd7..cbfd8fea2 100644 --- a/Tests/ValidatorBuilderTest.php +++ b/Tests/ValidatorBuilderTest.php @@ -118,7 +118,7 @@ public function testLegacyDefaultApiVersion() $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); // Legacy compatible implementation - $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); + $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); } public function testSetApiVersion25() @@ -135,6 +135,6 @@ public function testLegacySetApiVersion24And25() $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5_BC)); - $this->assertInstanceOf('Symfony\Component\Validator\Validator\LegacyValidator', $this->builder->getValidator()); + $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); } } diff --git a/Validator/LegacyValidator.php b/Validator/LegacyValidator.php index 8995f2cfd..f73a79ef0 100644 --- a/Validator/LegacyValidator.php +++ b/Validator/LegacyValidator.php @@ -11,9 +11,6 @@ namespace Symfony\Component\Validator\Validator; -use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GroupSequence; -use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; /** @@ -31,22 +28,9 @@ class LegacyValidator extends RecursiveValidator implements LegacyValidatorInter { public function validate($value, $groups = null, $traverse = false, $deep = false) { - $numArgs = func_num_args(); - - // 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; - - return parent::validate($value, $constraints, $groups); - } - 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); - $constraint = new Valid(array('traverse' => $traverse, 'deep' => $deep)); - - return parent::validate($value, $constraint, $groups); + return parent::validate($value, false, $groups, $traverse, $deep); } public function validateValue($value, $constraints, $groups = null) @@ -62,14 +46,4 @@ public function getMetadataFactory() return $this->metadataFactory; } - - private static function testConstraints($constraints) - { - return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint); - } - - 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)); - } } diff --git a/Validator/RecursiveValidator.php b/Validator/RecursiveValidator.php index ddf0850c1..7cfbc27fb 100644 --- a/Validator/RecursiveValidator.php +++ b/Validator/RecursiveValidator.php @@ -11,6 +11,9 @@ namespace Symfony\Component\Validator\Validator; +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; +use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\ConstraintValidatorFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextFactoryInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -112,6 +115,22 @@ public function hasMetadataFor($object) */ public function validate($value, $constraints = null, $groups = null) { + // 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; + } + } + } + return $this->startContext($value) ->validate($value, $constraints, $groups) ->getViolations(); @@ -137,4 +156,22 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) ->getViolations(); } + + /** + * @internal + * @deprecated since version 2.5, to be removed in 3.0. + */ + 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)); + } } diff --git a/ValidatorBuilder.php b/ValidatorBuilder.php index e47d1f42a..6b85b956e 100644 --- a/ValidatorBuilder.php +++ b/ValidatorBuilder.php @@ -19,7 +19,6 @@ use Symfony\Component\Translation\IdentityTranslator; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Validator\Context\ExecutionContextFactory; -use Symfony\Component\Validator\Context\LegacyExecutionContextFactory; use Symfony\Component\Validator\Exception\InvalidArgumentException; use Symfony\Component\Validator\Exception\ValidatorException; use Symfony\Component\Validator\Mapping\Cache\CacheInterface; @@ -31,7 +30,6 @@ use Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader; use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; use Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader; -use Symfony\Component\Validator\Validator\LegacyValidator; use Symfony\Component\Validator\Validator\RecursiveValidator; /** @@ -393,14 +391,8 @@ public function getValidator() $translator->setLocale('en'); } - if (Validation::API_VERSION_2_5 === $apiVersion) { - $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain); + $contextFactory = new ExecutionContextFactory($translator, $this->translationDomain); - return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); - } - - $contextFactory = new LegacyExecutionContextFactory($metadataFactory, $translator, $this->translationDomain); - - return new LegacyValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); + return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers); } } From d20f8e2b941bb66b96f01f2383801d0b89dfdbda Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 25 Jan 2015 06:54:05 +0100 Subject: [PATCH 4/6] [Validator] deprecated API version --- Tests/ValidatorBuilderTest.php | 25 +------------------------ ValidatorBuilder.php | 21 +++++---------------- ValidatorBuilderInterface.php | 2 ++ 3 files changed, 8 insertions(+), 40 deletions(-) diff --git a/Tests/ValidatorBuilderTest.php b/Tests/ValidatorBuilderTest.php index cbfd8fea2..88e8b3b82 100644 --- a/Tests/ValidatorBuilderTest.php +++ b/Tests/ValidatorBuilderTest.php @@ -110,31 +110,8 @@ public function testSetTranslationDomain() $this->assertSame($this->builder, $this->builder->setTranslationDomain('TRANS_DOMAIN')); } - /** - * @group legacy - */ - public function testLegacyDefaultApiVersion() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - // Legacy compatible implementation - $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); - } - - public function testSetApiVersion25() + public function testGetValidator() { - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5)); - $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); - } - - /** - * @group legacy - */ - public function testLegacySetApiVersion24And25() - { - $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED); - - $this->assertSame($this->builder, $this->builder->setApiVersion(Validation::API_VERSION_2_5_BC)); $this->assertInstanceOf('Symfony\Component\Validator\Validator\RecursiveValidator', $this->builder->getValidator()); } } diff --git a/ValidatorBuilder.php b/ValidatorBuilder.php index 6b85b956e..dd772cf38 100644 --- a/ValidatorBuilder.php +++ b/ValidatorBuilder.php @@ -94,11 +94,6 @@ class ValidatorBuilder implements ValidatorBuilderInterface */ private $propertyAccessor; - /** - * @var int|null - */ - private $apiVersion; - /** * {@inheritdoc} */ @@ -318,18 +313,17 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor) /** * {@inheritdoc} + * + * @deprecated since version 2.7, to be removed in 3.0. */ public function setApiVersion($apiVersion) { + trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED); + if (!in_array($apiVersion, array(Validation::API_VERSION_2_4, Validation::API_VERSION_2_5, Validation::API_VERSION_2_5_BC))) { - throw new InvalidArgumentException(sprintf( - 'The requested API version is invalid: "%s"', - $apiVersion - )); + throw new InvalidArgumentException(sprintf('The requested API version is invalid: "%s"', $apiVersion)); } - $this->apiVersion = $apiVersion; - return $this; } @@ -339,11 +333,6 @@ public function setApiVersion($apiVersion) public function getValidator() { $metadataFactory = $this->metadataFactory; - $apiVersion = $this->apiVersion; - - if (null === $apiVersion) { - $apiVersion = Validation::API_VERSION_2_5_BC; - } if (!$metadataFactory) { $loaders = array(); diff --git a/ValidatorBuilderInterface.php b/ValidatorBuilderInterface.php index 6e2dd96a2..cc0007770 100644 --- a/ValidatorBuilderInterface.php +++ b/ValidatorBuilderInterface.php @@ -180,6 +180,8 @@ public function setPropertyAccessor(PropertyAccessorInterface $propertyAccessor) * * @see Validation::API_VERSION_2_5 * @see Validation::API_VERSION_2_5_BC + * + * @deprecated since version 2.7, to be removed in 3.0. */ public function setApiVersion($apiVersion); From 625816dba66619b4267d5a82a84160f8bcf0356f Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sun, 22 Mar 2015 16:12:19 +0100 Subject: [PATCH 5/6] 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. --- Context/ExecutionContext.php | 105 ++++++++++++---- Context/LegacyExecutionContext.php | 113 +----------------- Context/LegacyExecutionContextFactory.php | 2 + .../AbstractConstraintValidatorTest.php | 6 +- .../LegacyAllValidatorLegacyApiTest.php | 27 ----- .../LegacyBlankValidatorLegacyApiTest.php | 27 ----- .../LegacyCallbackValidatorLegacyApiTest.php | 27 ----- ...LegacyCardSchemeValidatorLegacyApiTest.php | 27 ----- .../LegacyChoiceValidatorLegacyApiTest.php | 27 ----- ...yCollectionValidatorArrayLegacyApiTest.php | 25 ---- ...ctionValidatorArrayObjectLegacyApiTest.php | 25 ---- ...alidatorCustomArrayObjectLegacyApiTest.php | 25 ---- ...LegacyCountValidatorArrayLegacyApiTest.php | 27 ----- ...cyCountValidatorCountableLegacyApiTest.php | 27 ----- .../LegacyCurrencyValidatorLegacyApiTest.php | 27 ----- .../LegacyDateTimeValidatorLegacyApiTest.php | 27 ----- .../LegacyDateValidatorLegacyApiTest.php | 27 ----- .../LegacyEmailValidatorLegacyApiTest.php | 27 ----- .../LegacyEqualToValidatorLegacyApiTest.php | 27 ----- ...LegacyExpressionValidatorLegacyApiTest.php | 27 ----- .../LegacyFalseValidatorLegacyApiTest.php | 27 ----- ...LegacyFileValidatorObjectLegacyApiTest.php | 27 ----- .../LegacyFileValidatorPathLegacyApiTest.php | 27 ----- ...eaterThanOrEqualValidatorLegacyApiTest.php | 27 ----- ...egacyGreaterThanValidatorLegacyApiTest.php | 27 ----- .../LegacyIbanValidatorLegacyApiTest.php | 27 ----- ...egacyIdenticalToValidatorLegacyApiTest.php | 27 ----- .../LegacyImageValidatorLegacyApiTest.php | 27 ----- .../LegacyIpValidatorLegacyApiTest.php | 27 ----- .../LegacyIsbnValidatorLegacyApiTest.php | 27 ----- .../LegacyIssnValidatorLegacyApiTest.php | 27 ----- .../LegacyLanguageValidatorLegacyApiTest.php | 27 ----- .../LegacyLengthValidatorLegacyApiTest.php | 27 ----- ...yLessThanOrEqualValidatorLegacyApiTest.php | 27 ----- .../LegacyLessThanValidatorLegacyApiTest.php | 27 ----- .../LegacyLocaleValidatorLegacyApiTest.php | 27 ----- .../LegacyLuhnValidatorLegacyApiTest.php | 27 ----- .../LegacyNotBlankValidatorLegacyApiTest.php | 27 ----- ...LegacyNotEqualToValidatorLegacyApiTest.php | 27 ----- ...cyNotIdenticalToValidatorLegacyApiTest.php | 27 ----- .../LegacyNotNullValidatorLegacyApiTest.php | 27 ----- .../LegacyNullValidatorLegacyApiTest.php | 27 ----- .../LegacyRangeValidatorLegacyApiTest.php | 27 ----- .../LegacyRegexValidatorLegacyApiTest.php | 27 ----- .../LegacyTimeValidatorLegacyApiTest.php | 27 ----- .../LegacyTrueValidatorLegacyApiTest.php | 27 ----- .../LegacyTypeValidatorLegacyApiTest.php | 29 ----- .../LegacyUrlValidatorLegacyApiTest.php | 27 ----- .../LegacyUuidValidatorLegacyApiTest.php | 27 ----- Validator/LegacyValidator.php | 24 +--- Validator/RecursiveValidator.php | 50 ++++---- 51 files changed, 122 insertions(+), 1389 deletions(-) delete mode 100644 Tests/Constraints/LegacyAllValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyDateValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyImageValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyIpValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyNullValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php delete mode 100644 Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php diff --git a/Context/ExecutionContext.php b/Context/ExecutionContext.php index 0079d2327..39f7d1506 100644 --- a/Context/ExecutionContext.php +++ b/Context/ExecutionContext.php @@ -14,13 +14,14 @@ 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 @@ public function addViolation($message, array $parameters = array(), $invalidValu // 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 @@ public function getPropertyPath($subPath = '') */ 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 @@ public function addViolationAt($subPath, $message, array $parameters = array(), */ 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 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals */ 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 @@ public function validateValue($value, $constraints, $subPath = '', $groups = nul */ 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; } /** diff --git a/Context/LegacyExecutionContext.php b/Context/LegacyExecutionContext.php index 8ce6bdb30..5ee7a228c 100644 --- a/Context/LegacyExecutionContext.php +++ b/Context/LegacyExecutionContext.php @@ -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 @@ public function __construct(ValidatorInterface $validator, $root, MetadataFactor $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; - } } diff --git a/Context/LegacyExecutionContextFactory.php b/Context/LegacyExecutionContextFactory.php index c24c1fad3..31fb4cbdd 100644 --- a/Context/LegacyExecutionContextFactory.php +++ b/Context/LegacyExecutionContextFactory.php @@ -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; diff --git a/Tests/Constraints/AbstractConstraintValidatorTest.php b/Tests/Constraints/AbstractConstraintValidatorTest.php index bc0812891..140f8e49b 100644 --- a/Tests/Constraints/AbstractConstraintValidatorTest.php +++ b/Tests/Constraints/AbstractConstraintValidatorTest.php @@ -21,7 +21,6 @@ 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 @@ protected function buildViolation($message) 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(); } diff --git a/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php b/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php deleted file mode 100644 index 649bfe1c7..000000000 --- a/Tests/Constraints/LegacyAllValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyAllValidatorLegacyApiTest extends AllValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php b/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php deleted file mode 100644 index 00b8a7ae6..000000000 --- a/Tests/Constraints/LegacyBlankValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyBlankValidatorLegacyApiTest extends BlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php b/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php deleted file mode 100644 index 8f3ea2b87..000000000 --- a/Tests/Constraints/LegacyCallbackValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyCallbackValidatorLegacyApiTest extends CallbackValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php b/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php deleted file mode 100644 index e4b41846d..000000000 --- a/Tests/Constraints/LegacyCardSchemeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyCardSchemeValidatorLegacyApiTest extends CardSchemeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php b/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php deleted file mode 100644 index 9237df551..000000000 --- a/Tests/Constraints/LegacyChoiceValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyChoiceValidatorLegacyApiTest extends ChoiceValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php b/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php deleted file mode 100644 index 45ca1df38..000000000 --- a/Tests/Constraints/LegacyCollectionValidatorArrayLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * 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; - } -} diff --git a/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php b/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php deleted file mode 100644 index f28aed3b1..000000000 --- a/Tests/Constraints/LegacyCollectionValidatorArrayObjectLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * 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; - } -} diff --git a/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php b/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php deleted file mode 100644 index b04053f24..000000000 --- a/Tests/Constraints/LegacyCollectionValidatorCustomArrayObjectLegacyApiTest.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * 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; - } -} diff --git a/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php b/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php deleted file mode 100644 index d36298811..000000000 --- a/Tests/Constraints/LegacyCountValidatorArrayLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyCountValidatorArrayLegacyApiTest extends CountValidatorArrayTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php b/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php deleted file mode 100644 index 33b87957b..000000000 --- a/Tests/Constraints/LegacyCountValidatorCountableLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyCountValidatorCountableLegacyApiTest extends CountValidatorCountableTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php b/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php deleted file mode 100644 index 85cd5d0a6..000000000 --- a/Tests/Constraints/LegacyCurrencyValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyCurrencyValidatorLegacyApiTest extends CurrencyValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php b/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php deleted file mode 100644 index be19302fc..000000000 --- a/Tests/Constraints/LegacyDateTimeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyDateTimeValidatorLegacyApiTest extends DateTimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php b/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php deleted file mode 100644 index 3235f4231..000000000 --- a/Tests/Constraints/LegacyDateValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyDateValidatorLegacyApiTest extends DateValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php b/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php deleted file mode 100644 index e5f101961..000000000 --- a/Tests/Constraints/LegacyEmailValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyEmailValidatorLegacyApiTest extends EmailValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php b/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php deleted file mode 100644 index 3a72cfbf5..000000000 --- a/Tests/Constraints/LegacyEqualToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyEqualToValidatorLegacyApiTest extends EqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php b/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php deleted file mode 100644 index 374bba085..000000000 --- a/Tests/Constraints/LegacyExpressionValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyExpressionValidatorLegacyApiTest extends ExpressionValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php b/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php deleted file mode 100644 index 5f7cb12bd..000000000 --- a/Tests/Constraints/LegacyFalseValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyFalseValidatorLegacyApiTest extends FalseValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php b/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php deleted file mode 100644 index 97d5f5969..000000000 --- a/Tests/Constraints/LegacyFileValidatorObjectLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyFileValidatorObjectLegacyApiTest extends FileValidatorObjectTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php b/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php deleted file mode 100644 index 2c298dffc..000000000 --- a/Tests/Constraints/LegacyFileValidatorPathLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyFileValidatorPathLegacyApiTest extends FileValidatorPathTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php b/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php deleted file mode 100644 index 08822a53b..000000000 --- a/Tests/Constraints/LegacyGreaterThanOrEqualValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyGreaterThanOrEqualValidatorLegacyApiTest extends GreaterThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php b/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php deleted file mode 100644 index 0808e9bd1..000000000 --- a/Tests/Constraints/LegacyGreaterThanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyGreaterThanValidatorLegacyApiTest extends GreaterThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php b/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php deleted file mode 100644 index 0ffc4b150..000000000 --- a/Tests/Constraints/LegacyIbanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyIbanValidatorLegacyApiTest extends IbanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php b/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php deleted file mode 100644 index aade84f65..000000000 --- a/Tests/Constraints/LegacyIdenticalToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyIdenticalToValidatorLegacyApiTest extends IdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php b/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php deleted file mode 100644 index d36c1752f..000000000 --- a/Tests/Constraints/LegacyImageValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyImageValidatorLegacyApiTest extends ImageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php b/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php deleted file mode 100644 index 315f2f9cc..000000000 --- a/Tests/Constraints/LegacyIpValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyIpValidatorLegacyApiTest extends IpValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php b/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php deleted file mode 100644 index 156827090..000000000 --- a/Tests/Constraints/LegacyIsbnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyIsbnValidatorLegacyApiTest extends IsbnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php b/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php deleted file mode 100644 index 2ff310416..000000000 --- a/Tests/Constraints/LegacyIssnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyIssnValidatorLegacyApiTest extends IssnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php deleted file mode 100644 index a6471b3d3..000000000 --- a/Tests/Constraints/LegacyLanguageValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLanguageValidatorLegacyApiTest extends LanguageValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php deleted file mode 100644 index 655f3d6ad..000000000 --- a/Tests/Constraints/LegacyLengthValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLengthValidatorLegacyApiTest extends LengthValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php deleted file mode 100644 index 2e07ab02c..000000000 --- a/Tests/Constraints/LegacyLessThanOrEqualValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLessThanOrEqualValidatorLegacyApiTest extends LessThanOrEqualValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php deleted file mode 100644 index 27592b0af..000000000 --- a/Tests/Constraints/LegacyLessThanValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLessThanValidatorLegacyApiTest extends LessThanValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php deleted file mode 100644 index f55d42205..000000000 --- a/Tests/Constraints/LegacyLocaleValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLocaleValidatorLegacyApiTest extends LocaleValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php b/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php deleted file mode 100644 index 58555266e..000000000 --- a/Tests/Constraints/LegacyLuhnValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyLuhnValidatorLegacyApiTest extends LuhnValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php b/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php deleted file mode 100644 index 0aaaa77c4..000000000 --- a/Tests/Constraints/LegacyNotBlankValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyNotBlankValidatorLegacyApiTest extends NotBlankValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php b/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php deleted file mode 100644 index df88f96b5..000000000 --- a/Tests/Constraints/LegacyNotEqualToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyNotEqualToValidatorLegacyApiTest extends NotEqualToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php b/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php deleted file mode 100644 index 25819a622..000000000 --- a/Tests/Constraints/LegacyNotIdenticalToValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyNotIdenticalToValidatorLegacyApiTest extends NotIdenticalToValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php b/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php deleted file mode 100644 index 41a9e5407..000000000 --- a/Tests/Constraints/LegacyNotNullValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyNotNullValidatorLegacyApiTest extends NotNullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php b/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php deleted file mode 100644 index 79536ced6..000000000 --- a/Tests/Constraints/LegacyNullValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyNullValidatorLegacyApiTest extends NullValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php b/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php deleted file mode 100644 index 866a59adf..000000000 --- a/Tests/Constraints/LegacyRangeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyRangeValidatorLegacyApiTest extends RangeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php b/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php deleted file mode 100644 index ed1a4648c..000000000 --- a/Tests/Constraints/LegacyRegexValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyRegexValidatorLegacyApiTest extends RegexValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php b/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php deleted file mode 100644 index 2458d873a..000000000 --- a/Tests/Constraints/LegacyTimeValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyTimeValidatorLegacyApiTest extends TimeValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php b/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php deleted file mode 100644 index 706c08373..000000000 --- a/Tests/Constraints/LegacyTrueValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyTrueValidatorLegacyApiTest extends TrueValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php b/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php deleted file mode 100644 index 26eb39ffb..000000000 --- a/Tests/Constraints/LegacyTypeValidatorLegacyApiTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyTypeValidatorLegacyApiTest extends TypeValidatorTest -{ - protected static $file; - - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php b/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php deleted file mode 100644 index 0830ddb40..000000000 --- a/Tests/Constraints/LegacyUrlValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyUrlValidatorLegacyApiTest extends UrlValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php b/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php deleted file mode 100644 index 4a4e36298..000000000 --- a/Tests/Constraints/LegacyUuidValidatorLegacyApiTest.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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 - * @group legacy - */ -class LegacyUuidValidatorLegacyApiTest extends UuidValidatorTest -{ - protected function getApiVersion() - { - return Validation::API_VERSION_2_5_BC; - } -} diff --git a/Validator/LegacyValidator.php b/Validator/LegacyValidator.php index f73a79ef0..6c5a10c35 100644 --- a/Validator/LegacyValidator.php +++ b/Validator/LegacyValidator.php @@ -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 @@ * * @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; - } } diff --git a/Validator/RecursiveValidator.php b/Validator/RecursiveValidator.php index 7cfbc27fb..c825bfa6f 100644 --- a/Validator/RecursiveValidator.php +++ b/Validator/RecursiveValidator.php @@ -19,6 +19,7 @@ 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 @@ * @since 2.5 * @author Bernhard Schussek */ -class RecursiveValidator implements ValidatorInterface +class RecursiveValidator implements ValidatorInterface, LegacyValidatorInterface { /** * @var ExecutionContextFactoryInterface @@ -113,22 +114,19 @@ public function hasMetadataFor($object) /** * {@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 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr } /** - * @internal - * @deprecated since version 2.5, to be removed in 3.0. + * {@inheritdoc} */ - private static function testConstraints($constraints) + public function validateValue($value, $constraints, $groups = null) { - return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint); + 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); } /** - * @internal - * @deprecated since version 2.5, to be removed in 3.0. + * {@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); + } + 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)); From a25d9ae6b624ebf268d7e7716a853f32b70f25a2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 23 Mar 2015 10:03:11 +0100 Subject: [PATCH 6/6] removed deprecated notices that make the tests fail --- Constraints/Deprecated/UuidValidator.php | 30 ------------------------ Constraints/UuidValidator.php | 6 ++--- 2 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 Constraints/Deprecated/UuidValidator.php diff --git a/Constraints/Deprecated/UuidValidator.php b/Constraints/Deprecated/UuidValidator.php deleted file mode 100644 index 46ca7ba67..000000000 --- a/Constraints/Deprecated/UuidValidator.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Constraints\Deprecated; - -trigger_error('Constants STRICT_PATTERN, LOOSE_PATTERN and STRICT_UUID_LENGTH in class Symfony\Component\Validator\Constraints\UuidValidator are deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED); - -/** - * @deprecated since version 2.7, to be removed in 3.0. - * @internal - */ -final class UuidValidator -{ - const STRICT_PATTERN = '/^[a-f0-9]{8}-[a-f0-9]{4}-[%s][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i'; - const LOOSE_PATTERN = '/^[a-f0-9]{4}(?:-?[a-f0-9]{4}){7}$/i'; - const STRICT_UUID_LENGTH = 36; - - private function __construct() - { - - } -} diff --git a/Constraints/UuidValidator.php b/Constraints/UuidValidator.php index 245b64d3f..d64e6a49a 100644 --- a/Constraints/UuidValidator.php +++ b/Constraints/UuidValidator.php @@ -60,17 +60,17 @@ class UuidValidator extends ConstraintValidator /** * @deprecated since version 2.6, to be removed in 3.0 */ - const STRICT_PATTERN = Deprecated::STRICT_PATTERN; + const STRICT_PATTERN = '/^[a-f0-9]{8}-[a-f0-9]{4}-[%s][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i'; /** * @deprecated since version 2.6, to be removed in 3.0 */ - const LOOSE_PATTERN = Deprecated::LOOSE_PATTERN; + const LOOSE_PATTERN = '/^[a-f0-9]{4}(?:-?[a-f0-9]{4}){7}$/i'; /** * @deprecated since version 2.6, to be removed in 3.0 */ - const STRICT_UUID_LENGTH = Deprecated::STRICT_UUID_LENGTH; + const STRICT_UUID_LENGTH = 36; /** * {@inheritdoc}