[VarDumper] Cherry-pick code style fixes from 2.7
This commit is contained in:
parent
88e99d2244
commit
edf793ead2
@ -63,8 +63,9 @@ class DOMCaster
|
||||
|
||||
public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (isset($a["\0*\0code"], self::$errorCodes[$a["\0*\0code"]])) {
|
||||
$a["\0*\0code"] = new ConstStub(self::$errorCodes[$a["\0*\0code"]], $a["\0*\0code"]);
|
||||
$k = "\0*\0code";
|
||||
if (isset($a[$k], self::$errorCodes[$a[$k]])) {
|
||||
$a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
|
||||
}
|
||||
|
||||
return $a;
|
||||
|
@ -25,34 +25,35 @@ class DoctrineCaster
|
||||
{
|
||||
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
unset(
|
||||
$a['__cloner__'],
|
||||
$a['__initializer__']
|
||||
);
|
||||
$stub->cut += 2;
|
||||
foreach (array('__cloner__', '__initializer__') as $k) {
|
||||
if (array_key_exists($k, $a)) {
|
||||
unset($a[$k]);
|
||||
++$stub->cut;
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = "\0Doctrine\\ORM\\Proxy\\Proxy\0";
|
||||
unset(
|
||||
$a[$prefix.'_entityPersister'],
|
||||
$a[$prefix.'_identifier']
|
||||
);
|
||||
$stub->cut += 2;
|
||||
foreach (array('_entityPersister', '_identifier') as $k) {
|
||||
if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
|
||||
unset($a[$k]);
|
||||
++$stub->cut;
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = "\0Doctrine\\ORM\\PersistentCollection\0";
|
||||
|
||||
$a[$prefix.'snapshot'] = new CutStub($a[$prefix.'snapshot']);
|
||||
$a[$prefix.'association'] = new CutStub($a[$prefix.'association']);
|
||||
$a[$prefix.'typeClass'] = new CutStub($a[$prefix.'typeClass']);
|
||||
foreach (array('snapshot', 'association', 'typeClass') as $k) {
|
||||
if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
|
||||
$a[$k] = new CutStub($a[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
@ -43,8 +43,12 @@ class ExceptionCaster
|
||||
public static function castException(\Exception $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$xPrefix = PHP_VERSION_ID >= 70000 ? "\0BaseException\0" : "\0Exception\0";
|
||||
if (isset($a[$xPrefix.'trace'])) {
|
||||
$trace = $a[$xPrefix.'trace'];
|
||||
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
|
||||
} else {
|
||||
$trace = array();
|
||||
}
|
||||
|
||||
static::filterTrace($trace, static::$traceArgs);
|
||||
|
||||
@ -70,20 +74,21 @@ class ExceptionCaster
|
||||
|
||||
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = "\0*\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(
|
||||
'file' => $b["\0*\0file"],
|
||||
'line' => $b["\0*\0line"],
|
||||
'file' => $b[$prefix.'file'],
|
||||
'line' => $b[$prefix.'line'],
|
||||
);
|
||||
array_splice($b[$xPrefix.'trace'], -1 - count($a[$xPrefix.'trace']));
|
||||
static::filterTrace($b[$xPrefix.'trace'], false);
|
||||
$a["\0~\0trace"] = $b[$xPrefix.'trace'];
|
||||
}
|
||||
|
||||
unset($a[$xPrefix.'trace'], $a[$xPrefix.'previous'], $a["\0*\0code"], $a["\0*\0file"], $a["\0*\0line"]);
|
||||
unset($a[$xPrefix.'trace'], $a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
@ -78,21 +78,21 @@ class PdoCaster
|
||||
}
|
||||
}
|
||||
|
||||
$m = "\0~\0";
|
||||
$prefix = "\0~\0";
|
||||
$a += array(
|
||||
$m.'inTransaction' => method_exists($c, 'inTransaction'),
|
||||
$m.'errorInfo' => $c->errorInfo(),
|
||||
$m.'attributes' => $attr,
|
||||
$prefix.'inTransaction' => method_exists($c, 'inTransaction'),
|
||||
$prefix.'errorInfo' => $c->errorInfo(),
|
||||
$prefix.'attributes' => $attr,
|
||||
);
|
||||
|
||||
if ($a[$m.'inTransaction']) {
|
||||
$a[$m.'inTransaction'] = $c->inTransaction();
|
||||
if ($a[$prefix.'inTransaction']) {
|
||||
$a[$prefix.'inTransaction'] = $c->inTransaction();
|
||||
} else {
|
||||
unset($a[$m.'inTransaction']);
|
||||
unset($a[$prefix.'inTransaction']);
|
||||
}
|
||||
|
||||
if (!isset($a[$m.'errorInfo'][1], $a[$m.'errorInfo'][2])) {
|
||||
unset($a[$m.'errorInfo']);
|
||||
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
|
||||
unset($a[$prefix.'errorInfo']);
|
||||
}
|
||||
|
||||
$c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
|
||||
@ -102,11 +102,11 @@ class PdoCaster
|
||||
|
||||
public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$m = "\0~\0";
|
||||
$a[$m.'errorInfo'] = $c->errorInfo();
|
||||
$prefix = "\0~\0";
|
||||
$a[$prefix.'errorInfo'] = $c->errorInfo();
|
||||
|
||||
if (!isset($a[$m.'errorInfo'][1], $a[$m.'errorInfo'][2])) {
|
||||
unset($a[$m.'errorInfo']);
|
||||
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
|
||||
unset($a[$prefix.'errorInfo']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
|
@ -22,14 +22,15 @@ class SplCaster
|
||||
{
|
||||
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = "\0~\0";
|
||||
$class = $stub->class;
|
||||
$flags = $c->getFlags();
|
||||
|
||||
$b = array(
|
||||
"\0~\0flag::STD_PROP_LIST" => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
|
||||
"\0~\0flag::ARRAY_AS_PROPS" => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
|
||||
"\0~\0iteratorClass" => $c->getIteratorClass(),
|
||||
"\0~\0storage" => $c->getArrayCopy(),
|
||||
$prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
|
||||
$prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
|
||||
$prefix.'iteratorClass' => $c->getIteratorClass(),
|
||||
$prefix.'storage' => $c->getArrayCopy(),
|
||||
);
|
||||
|
||||
if ($class === 'ArrayObject') {
|
||||
@ -68,12 +69,13 @@ class SplCaster
|
||||
|
||||
public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = "\0~\0";
|
||||
$mode = $c->getIteratorMode();
|
||||
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
|
||||
|
||||
$a += array(
|
||||
"\0~\0mode" => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
|
||||
"\0~\0dllist" => iterator_to_array($c),
|
||||
$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_KEEP) ? 'IT_MODE_KEEP' : 'IT_MODE_DELETE'), $mode),
|
||||
$prefix.'dllist' => iterator_to_array($c),
|
||||
);
|
||||
$c->setIteratorMode($mode);
|
||||
|
||||
|
Reference in New Issue
Block a user