Commit a21acb3b authored by catch's avatar catch

Issue #2278353 by cilefen, dawehner, hussainweb, jibran, andyceo: Update to Symfony 2.5.

parent 0189add1
This diff is collapsed.
......@@ -15,8 +15,8 @@
use Drupal\Core\TypedData\Validation\MetadataFactory;
use Drupal\Core\Validation\ConstraintManager;
use Drupal\Core\Validation\DrupalTranslator;
use Symfony\Component\Validator\ValidatorInterface;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* Manages data type plugins.
......@@ -298,7 +298,7 @@ public function getPropertyInstance(TypedDataInterface $object, $property_name,
/**
* Sets the validator for validating typed data.
*
* @param \Symfony\Component\Validator\ValidatorInterface $validator
* @param \Symfony\Component\Validator\Validator\ValidatorInterface $validator
* The validator object to set.
*/
public function setValidator(ValidatorInterface $validator) {
......@@ -308,7 +308,7 @@ public function setValidator(ValidatorInterface $validator) {
/**
* Gets the validator for validating typed data.
*
* @return \Symfony\Component\Validator\ValidatorInterface
* @return \Symfony\Component\Validator\Validator\ValidatorInterface
* The validator object.
*/
public function getValidator() {
......@@ -316,6 +316,7 @@ public function getValidator() {
$this->validator = Validation::createValidatorBuilder()
->setMetadataFactory(new MetadataFactory())
->setTranslator(new DrupalTranslator())
->setApiVersion(Validation::API_VERSION_2_4)
->getValidator();
}
return $this->validator;
......
......@@ -101,7 +101,7 @@ public function registerDefinitions() {
));
$this->discovery->setDefinition('Email', array(
'label' => new TranslationWrapper('Email'),
'class' => '\Symfony\Component\Validator\Constraints\Email',
'class' => '\Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint',
'type' => array('string'),
));
}
......
<?php
/**
* @file
* Contains \Drupal\Core\Validation\Plugin\Validation\Constraint\EmailConstraint.
*/
namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraints\Email;
/**
* Count constraint.
*
* Overrides the symfony constraint to use the strict setting.
*
* @Plugin(
* id = "Email",
* label = @Translation("Email", context = "Validation")
* )
*/
class EmailConstraint extends Email {
public $strict = TRUE;
/**
* {@inheritdoc}
*/
public function validatedBy() {
return '\Symfony\Component\Validator\Constraints\EmailValidator';
}
}
......@@ -16,7 +16,6 @@
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,7 +15,7 @@
* ApcClassLoader implements a wrapping autoloader cached in APC for PHP 5.3.
*
* It expects an object implementing a findFile method to find the file. This
* allow using it as a wrapper around the other loaders of the component (the
* allows using it as a wrapper around the other loaders of the component (the
* ClassLoader and the UniversalClassLoader for instance) but also around any
* other autoloader following this convention (the Composer one for instance)
*
......@@ -46,7 +46,7 @@ class ApcClassLoader
/**
* The class loader object being decorated.
*
* @var \Symfony\Component\ClassLoader\ClassLoader
* @var object
* A class loader object that implements the findFile() method.
*/
protected $decorated;
......@@ -79,7 +79,7 @@ public function __construct($prefix, $decorated)
/**
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
......@@ -99,7 +99,7 @@ public function unregister()
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
* @return bool|null True, if loaded
*/
public function loadClass($class)
{
......@@ -133,5 +133,4 @@ public function __call($method, $args)
{
return call_user_func_array(array($this->decorated, $method), $args);
}
}
......@@ -28,8 +28,8 @@ class ClassCollectionLoader
* @param array $classes An array of classes to load
* @param string $cacheDir A cache directory
* @param string $name The cache name prefix
* @param Boolean $autoReload Whether to flush the cache when the cache is stale or not
* @param Boolean $adaptive Whether to remove already declared classes or not
* @param bool $autoReload Whether to flush the cache when the cache is stale or not
* @param bool $adaptive Whether to remove already declared classes or not
* @param string $extension File extension of the resulting file
*
* @throws \InvalidArgumentException When class can't be loaded
......@@ -200,7 +200,7 @@ public static function fixNamespaceDeclarations($source)
*/
public static function enableTokenizer($bool)
{
self::$useTokenizer = (Boolean) $bool;
self::$useTokenizer = (bool) $bool;
}
/**
......
......@@ -103,7 +103,7 @@ public function addPrefix($prefix, $paths)
/**
* Turns on searching the include for class files.
*
* @param Boolean $useIncludePath
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
......@@ -114,7 +114,7 @@ public function setUseIncludePath($useIncludePath)
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return Boolean
* @return bool
*/
public function getUseIncludePath()
{
......@@ -124,7 +124,7 @@ public function getUseIncludePath()
/**
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
......@@ -144,7 +144,7 @@ public function unregister()
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
* @return bool|null True, if loaded
*/
public function loadClass($class)
{
......
......@@ -11,6 +11,10 @@
namespace Symfony\Component\ClassLoader;
if (!defined('T_TRAIT')) {
define('T_TRAIT', 0);
}
/**
* ClassMapGenerator
*
......@@ -67,7 +71,6 @@ public static function createMap($dir)
foreach ($classes as $class) {
$map[$class] = $path;
}
}
return $map;
......@@ -84,7 +87,6 @@ private static function findClasses($path)
{
$contents = file_get_contents($path);
$tokens = token_get_all($contents);
$T_TRAIT = version_compare(PHP_VERSION, '5.4', '<') ? -1 : T_TRAIT;
$classes = array();
......@@ -111,7 +113,7 @@ private static function findClasses($path)
break;
case T_CLASS:
case T_INTERFACE:
case $T_TRAIT:
case T_TRAIT:
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {
......
......@@ -98,7 +98,7 @@ public function findFile($class)
*
* @param string $class The name of the class
*