Merge branch '2.8'

* 2.8:
  Fix tests when no Intl extension
  [VarDumper] Fix casting for ReflectionParameter
  [HttpKernel] Keep 3.0 compat by not using ContainerAware
  [DI] Clean a phpdoc
  [Security\Core] Deprecate passing $salt to BCryptPasswordEncoder::encodePassword()

Conflicts:
	src/Symfony/Component/DependencyInjection/ContainerAware.php
	src/Symfony/Component/HttpKernel/Bundle/Bundle.php
	src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
	src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
	src/Symfony/Component/VarDumper/Tests/Test/VarDumperTestTraitTest.php
This commit is contained in:
Nicolas Grekas 2015-11-05 11:29:45 +01:00
commit 4a177d7cb9
6 changed files with 38 additions and 5 deletions

View File

@ -19,7 +19,7 @@ namespace Symfony\Component\DependencyInjection;
interface ContainerAwareInterface
{
/**
* Sets the Container.
* Sets the container.
*
* @param ContainerInterface|null $container A ContainerInterface instance or null
*/

View File

@ -24,9 +24,9 @@ trait ContainerAwareTrait
protected $container;
/**
* Sets the Container associated with this Controller.
* Sets the container.
*
* @param ContainerInterface $container A ContainerInterface instance
* @param ContainerInterface|null $container A ContainerInterface instance or null
*/
public function setContainer(ContainerInterface $container = null)
{

View File

@ -365,6 +365,9 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('GMT+03:00', $formatter->format(0));
}
/**
* @requires extension intl
*/
public function testFormatWithIntlTimeZone()
{
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, \IntlTimeZone::createTimeZone('GMT+03:00'), IntlDateFormatter::GREGORIAN, 'zzzz');

View File

@ -71,7 +71,7 @@ class BCryptPasswordEncoder extends BasePasswordEncoder
$options = array('cost' => $this->cost);
if ($salt) {
$options['salt'] = $salt;
// Ignore $salt, the auto-generated one is always the best
}
return password_hash($raw, PASSWORD_BCRYPT, $options);

View File

@ -206,6 +206,9 @@ class ReflectionCaster
{
$prefix = Caster::PREFIX_VIRTUAL;
// Added by HHVM
unset($a['info']);
self::addMap($a, $c, array(
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
@ -221,6 +224,9 @@ class ReflectionCaster
$a[$prefix.'typeHint'] = $v->name;
}
} catch (\ReflectionException $e) {
if (preg_match('/^Class ([^ ]++) does not exist$/', $e->getMessage(), $m)) {
$a[$prefix.'typeHint'] = $m[1];
}
}
try {
@ -229,6 +235,9 @@ class ReflectionCaster
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
} catch (\ReflectionException $e) {
if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) {
$a[$prefix.'default'] = null;
}
}
return $a;

View File

@ -82,6 +82,23 @@ EOTXT
);
}
public function testReflectionParameter()
{
$var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0);
$this->assertDumpMatchesFormat(
<<<'EOTXT'
ReflectionParameter {
+name: "arg1"
position: 0
typeHint: "Symfony\Component\VarDumper\Tests\Caster\NotExistingClass"
default: null
}
EOTXT
, $var
);
}
/**
* @requires PHP 7.0
*/
@ -95,7 +112,7 @@ Closure {
returnType: "int"
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { }
file: "%sReflectionCasterTest.php(90) : eval()'d code"
file: "%sReflectionCasterTest.php(107) : eval()'d code"
line: "1 to 1"
}
EOTXT
@ -184,3 +201,7 @@ EODUMP;
$this->assertDumpMatchesFormat($xDump, array($r, $r->getExecutingGenerator()));
}
}
function reflectionParameterFixture(NotExistingClass $arg1 = null, $arg2)
{
}