Merge branch '2.7' into 2.8
* 2.7: [VarDumper] Fix casting for ReflectionParameter [DI] Clean a phpdoc Conflicts: src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
This commit is contained in:
commit
c812b39ae7
@ -26,9 +26,9 @@ abstract class ContainerAware implements ContainerAwareInterface
|
||||
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)
|
||||
{
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -217,6 +217,9 @@ class ReflectionCaster
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
// Added by HHVM
|
||||
unset($a['info']);
|
||||
|
||||
self::addMap($a, $c, array(
|
||||
'position' => 'getPosition',
|
||||
'isVariadic' => 'isVariadic',
|
||||
@ -232,6 +235,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 {
|
||||
@ -240,6 +246,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;
|
||||
|
@ -80,6 +80,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
|
||||
*/
|
||||
@ -93,7 +110,7 @@ Closure {
|
||||
returnType: "int"
|
||||
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
|
||||
file: "%sReflectionCasterTest.php(88) : eval()'d code"
|
||||
file: "%sReflectionCasterTest.php(105) : eval()'d code"
|
||||
line: "1 to 1"
|
||||
}
|
||||
EOTXT
|
||||
@ -182,3 +199,7 @@ EODUMP;
|
||||
$this->assertDumpMatchesFormat($xDump, array($r, $r->getExecutingGenerator()));
|
||||
}
|
||||
}
|
||||
|
||||
function reflectionParameterFixture(NotExistingClass $arg1 = null, $arg2)
|
||||
{
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
// Skipping trait tests for PHP < 5.4
|
||||
if (version_compare(PHP_VERSION, '5.4.0-dev', '>=')) {
|
||||
require 'VarDumpTestTraitRequire54.php';
|
||||
if (PHP_VERSION_ID >= 50400) {
|
||||
require __DIR__.'/VarDumperTestTraitRequire54.php';
|
||||
}
|
||||
|
Reference in New Issue
Block a user