[VarDumper] Fix generic casters calling order
This commit is contained in:
parent
dc296cc951
commit
ec124e078a
@ -25,34 +25,35 @@ class DoctrineCaster
|
|||||||
{
|
{
|
||||||
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
|
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
|
||||||
{
|
{
|
||||||
unset(
|
foreach (array('__cloner__', '__initializer__') as $k) {
|
||||||
$a['__cloner__'],
|
if (array_key_exists($k, $a)) {
|
||||||
$a['__initializer__']
|
unset($a[$k]);
|
||||||
);
|
++$stub->cut;
|
||||||
$stub->cut += 2;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
|
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
|
||||||
{
|
{
|
||||||
$prefix = "\0Doctrine\\ORM\\Proxy\\Proxy\0";
|
foreach (array('_entityPersister', '_identifier') as $k) {
|
||||||
unset(
|
if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
|
||||||
$a[$prefix.'_entityPersister'],
|
unset($a[$k]);
|
||||||
$a[$prefix.'_identifier']
|
++$stub->cut;
|
||||||
);
|
}
|
||||||
$stub->cut += 2;
|
}
|
||||||
|
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
|
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
|
||||||
{
|
{
|
||||||
$prefix = "\0Doctrine\\ORM\\PersistentCollection\0";
|
foreach (array('snapshot', 'association', 'typeClass') as $k) {
|
||||||
|
if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
|
||||||
$a[$prefix.'snapshot'] = new CutStub($a[$prefix.'snapshot']);
|
$a[$k] = new CutStub($a[$k]);
|
||||||
$a[$prefix.'association'] = new CutStub($a[$prefix.'association']);
|
}
|
||||||
$a[$prefix.'typeClass'] = new CutStub($a[$prefix.'typeClass']);
|
}
|
||||||
|
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,12 @@ class ExceptionCaster
|
|||||||
public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
|
public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
|
||||||
{
|
{
|
||||||
$xPrefix = PHP_VERSION_ID >= 70000 ? "\0BaseException\0" : "\0Exception\0";
|
$xPrefix = PHP_VERSION_ID >= 70000 ? "\0BaseException\0" : "\0Exception\0";
|
||||||
$trace = $a[$xPrefix.'trace'];
|
if (isset($a[$xPrefix.'trace'])) {
|
||||||
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
|
$trace = $a[$xPrefix.'trace'];
|
||||||
|
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
|
||||||
|
} else {
|
||||||
|
$trace = array();
|
||||||
|
}
|
||||||
|
|
||||||
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
|
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
|
||||||
static::filterTrace($trace, static::$traceArgs);
|
static::filterTrace($trace, static::$traceArgs);
|
||||||
@ -74,9 +78,9 @@ class ExceptionCaster
|
|||||||
{
|
{
|
||||||
$prefix = Caster::PREFIX_PROTECTED;
|
$prefix = Caster::PREFIX_PROTECTED;
|
||||||
$xPrefix = PHP_VERSION_ID >= 70000 ? "\0BaseException\0" : "\0Exception\0";
|
$xPrefix = PHP_VERSION_ID >= 70000 ? "\0BaseException\0" : "\0Exception\0";
|
||||||
$b = (array) $a[$xPrefix.'previous'];
|
|
||||||
|
|
||||||
if (isset($a[$xPrefix.'trace'][0])) {
|
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'][0])) {
|
||||||
|
$b = (array) $a[$xPrefix.'previous'];
|
||||||
$b[$xPrefix.'trace'][0] += array(
|
$b[$xPrefix.'trace'][0] += array(
|
||||||
'file' => $b[$prefix.'file'],
|
'file' => $b[$prefix.'file'],
|
||||||
'line' => $b[$prefix.'line'],
|
'line' => $b[$prefix.'line'],
|
||||||
|
@ -214,7 +214,7 @@ abstract class AbstractCloner implements ClonerInterface
|
|||||||
$classInfo = array(
|
$classInfo = array(
|
||||||
$class,
|
$class,
|
||||||
new \ReflectionClass($class),
|
new \ReflectionClass($class),
|
||||||
array_reverse(array('*' => '*', $class => $class) + class_parents($class) + class_implements($class)),
|
array_reverse(array($class => $class) + class_parents($class) + class_implements($class) + array('*' => '*')),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->classInfo[$class] = $classInfo;
|
$this->classInfo[$class] = $classInfo;
|
||||||
|
@ -139,12 +139,12 @@ EOTXT;
|
|||||||
{
|
{
|
||||||
$cloner = new VarCloner(array(
|
$cloner = new VarCloner(array(
|
||||||
'*' => function ($obj, $array) {
|
'*' => function ($obj, $array) {
|
||||||
$array['foo'] = 123;
|
return array('foo' => 123);
|
||||||
|
|
||||||
return $array;
|
|
||||||
},
|
},
|
||||||
__CLASS__ => function ($obj, $array) {
|
__CLASS__ => function ($obj, $array) {
|
||||||
return array();
|
++$array['foo'];
|
||||||
|
|
||||||
|
return $array;
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
$clone = $cloner->cloneVar($this);
|
$clone = $cloner->cloneVar($this);
|
||||||
@ -171,7 +171,7 @@ Symfony\Component\VarDumper\Cloner\Data Object
|
|||||||
|
|
||||||
[1] => Array
|
[1] => Array
|
||||||
(
|
(
|
||||||
[foo] => 123
|
[foo] => 124
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user