Commit bf00ad1c authored by webchick's avatar webchick

Issue #1849564 by attiks, Rob Loach, fago: Add the symfony validator component...

Issue #1849564 by attiks, Rob Loach, fago: Add the symfony validator component to core despite Symfony potentially releasing BC-breaking updates after 2.3.
parent dc28083a
......@@ -10,6 +10,7 @@
"symfony/http-kernel": "<2.4",
"symfony/routing": "<2.4",
"symfony/serializer": "<2.4",
"symfony/validator": "<2.4",
"symfony/yaml": "<2.4",
"twig/twig": "1.*@stable",
"doctrine/common": "2.3.*@stable",
......
{
"hash": "4c18d6f1c91b78555300b0036b5a8a7e",
"hash": "fb8595c6fbaaa5bf51bf7efeb67d73bc",
"packages": [
{
"name": "doctrine/common",
......@@ -25,6 +25,7 @@
"dev-master": "2.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common": "lib/"
......@@ -97,6 +98,7 @@
},
"time": "2013-01-13 01:20:04",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-0": {
"EasyRdf_": "lib/"
......@@ -150,6 +152,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Common": ""
......@@ -197,6 +200,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Http": ""
......@@ -248,6 +252,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Parser": ""
......@@ -293,6 +298,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Stream": ""
......@@ -354,6 +360,7 @@
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Assetic": "src/"
......@@ -405,6 +412,7 @@
"dev-master": "1.0-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Cmf\\Component\\Routing": ""
......@@ -455,6 +463,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\ClassLoader\\": ""
......@@ -510,6 +519,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\DependencyInjection\\": ""
......@@ -564,6 +574,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
......@@ -611,6 +622,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpFoundation\\": ""
......@@ -682,6 +694,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpKernel\\": ""
......@@ -724,6 +737,7 @@
},
"time": "2012-12-06 10:00:55",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Process": ""
......@@ -782,6 +796,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Routing\\": ""
......@@ -829,6 +844,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Serializer\\": ""
......@@ -851,6 +867,123 @@
"description": "Symfony Serializer Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/translation",
"version": "dev-master",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation",
"reference": "v2.2.0-BETA2"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Translation/archive/v2.2.0-BETA2.zip",
"reference": "v2.2.0-BETA2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"suggest": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"time": "2013-01-17 15:25:59",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/validator",
"version": "dev-master",
"target-dir": "Symfony/Component/Validator",
"source": {
"type": "git",
"url": "https://github.com/symfony/Validator",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Validator/archive/f764b2e61c51c45f93bd4c9fe933e6a66928d2d3.zip",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/translation": "2.2.*"
},
"require-dev": {
"symfony/http-foundation": "2.2.*",
"symfony/locale": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"suggest": {
"doctrine/common": ">=2.1,<2.4-dev",
"symfony/http-foundation": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"time": "2013-01-24 10:00:40",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Validator\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Validator Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/yaml",
"version": "dev-master",
......@@ -876,6 +1009,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
......@@ -922,6 +1056,7 @@
"dev-master": "1.11-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Twig_": "lib/"
......
......@@ -2,3 +2,13 @@
symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php
symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/php5.4/traits.php
symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php
# The resources for the Validator component are not required.
symfony/validator/Symfony/Component/Validator/Resources
# Symfony Validator depends on Symfony Translation but only requires the
# TranslatorInterface. Thus, we add only the required interface from Symfony
# Translation by ignoring everything except the interface.
symfony/translation/Symfony/Component/Translation/*
!symfony/translation/Symfony/Component/Translation/TranslatorInterface.php
......@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitdff5596d4902476e49b77f22ebf69e4a::getLoader();
return ComposerAutoloaderInitb72eabc903127a0c876d43163fd09a25::getLoader();
......@@ -75,63 +75,30 @@ public function addClassMap(array $classMap)
}
/**
* Registers a set of classes, merging with any others previously set.
* Registers a set of classes
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param bool $prepend Prepend the location(s)
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function add($prefix, $paths, $prepend = false)
public function add($prefix, $paths)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
foreach ((array) $paths as $path) {
$this->fallbackDirs[] = $path;
}
return;
}
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$prefix] = array_merge(
(array) $paths,
$this->prefixes[$prefix]
);
} else {
if (isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
(array) $paths
);
} else {
$this->prefixes[$prefix] = (array) $paths;
}
}
/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;
return;
}
$this->prefixes[$prefix] = (array) $paths;
}
/**
* Turns on searching the include path for class files.
*
......
......@@ -8,6 +8,8 @@
return array(
'Twig_' => $vendorDir . '/twig/twig/lib/',
'Symfony\\Component\\Yaml\\' => $vendorDir . '/symfony/yaml/',
'Symfony\\Component\\Validator\\' => $vendorDir . '/symfony/validator/',
'Symfony\\Component\\Translation\\' => $vendorDir . '/symfony/translation/',
'Symfony\\Component\\Serializer\\' => $vendorDir . '/symfony/serializer/',
'Symfony\\Component\\Routing\\' => $vendorDir . '/symfony/routing/',
'Symfony\\Component\\Process' => $vendorDir . '/symfony/process/',
......
......@@ -2,7 +2,7 @@
// autoload_real.php generated by Composer
class ComposerAutoloaderInitdff5596d4902476e49b77f22ebf69e4a
class ComposerAutoloaderInitb72eabc903127a0c876d43163fd09a25
{
private static $loader;
......@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitdff5596d4902476e49b77f22ebf69e4a', 'loadClassLoader'));
spl_autoload_register(array('ComposerAutoloaderInitb72eabc903127a0c876d43163fd09a25', 'loadClassLoader'));
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitdff5596d4902476e49b77f22ebf69e4a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitb72eabc903127a0c876d43163fd09a25', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
......@@ -36,7 +36,7 @@ public static function getLoader()
$loader->addClassMap($classMap);
}
$loader->register(true);
$loader->register();
return $loader;
}
......
......@@ -980,5 +980,124 @@
"database",
"routing"
]
},
{
"name": "symfony/translation",
"version": "dev-master",
"version_normalized": "9999999-dev",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation",
"reference": "v2.2.0-BETA2"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Translation/archive/v2.2.0-BETA2.zip",
"reference": "v2.2.0-BETA2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"suggest": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"time": "2013-01-17 15:25:59",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/validator",
"version": "dev-master",
"version_normalized": "9999999-dev",
"target-dir": "Symfony/Component/Validator",
"source": {
"type": "git",
"url": "https://github.com/symfony/Validator",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Validator/archive/f764b2e61c51c45f93bd4c9fe933e6a66928d2d3.zip",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/translation": "2.2.*"
},
"require-dev": {
"symfony/http-foundation": "2.2.*",
"symfony/locale": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"suggest": {
"doctrine/common": ">=2.1,<2.4-dev",
"symfony/http-foundation": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"time": "2013-01-24 10:00:40",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Validator\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Validator Component",
"homepage": "http://symfony.com"
}
]
<?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\Translation;
/**
* TranslatorInterface.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
interface TranslatorInterface
{
/**
* Translates the given message.
*
* @param string $id The message id
* @param array $parameters An array of parameters for the message
* @param string $domain The domain for the message
* @param string $locale The locale
*
* @return string The translated string
*
* @api
*/
public function trans($id, array $parameters = array(), $domain = null, $locale = null);
/**
* Translates the given choice message by choosing a translation according to a number.
*
* @param string $id The message id
* @param integer $number The number to use to find the indice of the message
* @param array $parameters An array of parameters for the message
* @param string $domain The domain for the message
* @param string $locale The locale
*
* @return string The translated string
*
* @api
*/
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);
/**
* Sets the current locale.
*
* @param string $locale The locale
*
* @api
*/
public function setLocale($locale);
/**
* Returns the current locale.
*
* @return string The locale
*
* @api
*/
public function getLocale();
}
CHANGELOG
=========
2.2.0
-----
* added a CardScheme validator
* added a Luhn validator
* moved @api-tags from `Validator` to `ValidatorInterface`
* moved @api-tags from `ConstraintViolation` to the new `ConstraintViolationInterface`
* moved @api-tags from `ConstraintViolationList` to the new `ConstraintViolationListInterface`
* moved @api-tags from `ExecutionContext` to the new `ExecutionContextInterface`
* [BC BREAK] `ConstraintValidatorInterface::initialize` is now type hinted against `ExecutionContextInterface` instead of `ExecutionContext`
* [BC BREAK] changed the visibility of the properties in `Validator` from protected to private
* deprecated `ClassMetadataFactoryInterface` in favor of the new `MetadataFactoryInterface`
* deprecated `ClassMetadataFactory::getClassMetadata` in favor of `getMetadataFor`
* created `MetadataInterface`, `PropertyMetadataInterface`, `ClassBasedInterface` and `PropertyMetadataContainerInterface`
* deprecated `GraphWalker` in favor of the new `ValidationVisitorInterface`
* deprecated `ExecutionContext::addViolationAtPath`
* deprecated `ExecutionContext::addViolationAtSubPath` in favor of `ExecutionContextInterface::addViolationAt`