Merge branch '2.3' into 2.6

* 2.3:
  [Validator] Add missing pt_BR translations
  Add parsing of hexadecimal strings for PHP 7
  [Configuration] improve description for ignoreExtraKeys on ArrayNodeDefinition
  [Validator] Added missing Hungarian translation
  [Validator] Fixed grammar in Hungarian translation
  CS: Unary operators should be placed adjacent to their operands
  CS: Binary operators should be arounded by at least one space
  remove useless tests that fail in php 7
  [Translator] fix test for php 7 compatibility
  Update phpdoc of ProcessBuilder#setPrefix()

Conflicts:
	src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php
	src/Symfony/Component/PropertyAccess/PropertyAccessor.php
	src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf
	src/Symfony/Component/Yaml/Parser.php
This commit is contained in:
Fabien Potencier 2015-03-30 17:54:10 +02:00
commit 2c4b5e5bbe
46 changed files with 133 additions and 133 deletions

View File

@ -279,9 +279,10 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* Allows extra config keys to be specified under an array without
* throwing an exception.
*
* Those config values are simply ignored. This should be used only
* in special cases where you want to send an entire configuration
* array through a special tree that processes only part of the array.
* Those config values are simply ignored and removed from the
* resulting array. This should be used only in special cases where
* you want to send an entire configuration array through a special
* tree that processes only part of the array.
*
* @return ArrayNodeDefinition
*/

View File

@ -207,6 +207,8 @@ class XmlUtils
return bindec($value);
case is_numeric($value):
return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value;
case preg_match('/^0x[0-9a-f]++$/i', $value):
return hexdec($value);
case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value):
return (float) $value;
default:

View File

@ -66,16 +66,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->objectChoices = null;
}
/**
* @expectedException \PHPUnit_Framework_Error
*/
public function testChoicesOptionExpectsArray()
{
$this->factory->create('choice', null, array(
'choices' => new \ArrayObject(),
));
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/

View File

@ -68,7 +68,7 @@ class ProcessBuilder
}
/**
* Adds an unescaped prefix to the command string.
* Adds a prefix to the command string.
*
* The prefix is preserved when resetting arguments.
*

View File

@ -52,23 +52,6 @@ class RememberMeTokenTest extends \PHPUnit_Framework_TestCase
);
}
/**
* @expectedException \PHPUnit_Framework_Error
* @dataProvider getUserArguments
*/
public function testConstructorUserCannotBeNull($user)
{
new RememberMeToken($user, 'foo', 'foo');
}
public function getUserArguments()
{
return array(
array(null),
array('foo'),
);
}
protected function getUser($roles = array('ROLE_FOO'))
{
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');

View File

@ -358,7 +358,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
return array(
array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''),
array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''),
array('Symfony est super !', new String('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''),
array('Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''),
);
}
@ -404,7 +404,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
array('Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1), 'fr', ''),
array('Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10), 'fr', ''),
array('Il y a 0 pomme', new String('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
array('Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0), 'fr', ''),
);
}
@ -588,7 +588,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
}
}
class String
class StringClass
{
protected $str;

View File

@ -36,7 +36,7 @@
</trans-unit>
<trans-unit id="9">
<source>This field was not expected.</source>
<target>Ez a mező nem számítottak.</target>
<target>Nem várt mező.</target>
</trans-unit>
<trans-unit id="10">
<source>This field is missing.</source>
@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source>
<target>Üres fájl nem megengedett.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Ez az érték nem az elvárt {{ charset }} karakterkódolást használja.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -302,6 +302,14 @@
<source>An empty file is not allowed.</source>
<target>Arquivo vazio não é permitido.</target>
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>O host não pôde ser resolvido.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Este valor não corresponde ao charset {{ charset }} esperado.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -149,6 +149,7 @@ class Inline
case Escaper::requiresDoubleQuoting($value):
return Escaper::escapeWithDoubleQuotes($value);
case Escaper::requiresSingleQuoting($value):
case preg_match(self::getHexRegex(), $value):
case preg_match(self::getTimestampRegex(), $value):
return Escaper::escapeWithSingleQuotes($value);
default:
@ -491,6 +492,7 @@ class Inline
return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw === (string) $cast) ? $cast : $raw);
case is_numeric($scalar):
case preg_match(self::getHexRegex(), $scalar):
return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
case '.inf' === $scalarLower:
case '.nan' === $scalarLower:
@ -531,4 +533,14 @@ class Inline
$~x
EOF;
}
/**
* Gets a regex that matches a YAML number in hexadecimal notation.
*
* @return string
*/
private static function getHexRegex()
{
return '~^0x[0-9a-f]++$~i';
}
}