Skip to content

Commit

Permalink
minor #23637 [VarDumper] Remove dead code (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.0-dev branch.

Discussion
----------

[VarDumper] Remove dead code

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Unneeded since the symfony_debug extension doesn't exist for php7.

Commits
-------

1b56b2b [VarDumper] Remove dead code
  • Loading branch information
nicolas-grekas committed Jul 24, 2017
2 parents 88666dd + 1b56b2b commit c431fd9
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/Symfony/Component/VarDumper/Cloner/VarCloner.php
Expand Up @@ -44,15 +44,10 @@ protected function doClone($var)
$a = null; // Array cast for nested structures
$stub = null; // Stub capturing the main properties of an original item value
// or null if the original value is used directly
$zval = array( // Main properties of the current value
'type' => null,
'zval_isref' => null,
'zval_hash' => null,
'array_count' => null,
'object_class' => null,
'object_handle' => null,
'resource_type' => null,
);
$zvalType = null; // Main properties of the current value
$zvalIsRef = null;
$zvalHash = null;

if (!self::$hashMask) {
self::initHashMask();
}
Expand Down Expand Up @@ -84,14 +79,14 @@ protected function doClone($var)
$k = $j;
}
$refs[$k] = $cookie;
if ($zval['zval_isref'] = $vals[$k] === $cookie) {
$zval['zval_hash'] = $v instanceof Stub ? spl_object_hash($v) : null;
if ($zvalIsRef = $vals[$k] === $cookie) {
$zvalHash = $v instanceof Stub ? spl_object_hash($v) : null;
}
$zval['type'] = gettype($v);
if ($zval['zval_isref']) {
$zvalType = gettype($v);
if ($zvalIsRef) {
$vals[$k] = &$stub; // Break hard references to make $queue completely
unset($stub); // independent from the original structure
if (isset($hardRefs[$zval['zval_hash']])) {
if (isset($hardRefs[$zvalHash])) {
$vals[$k] = $refs[$k] = $v;
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
Expand All @@ -102,7 +97,7 @@ protected function doClone($var)
}
// Create $stub when the original value $v can not be used directly
// If $v is a nested structure, put that structure in array $a
switch ($zval['type']) {
switch ($zvalType) {
case 'string':
if (isset($v[0]) && !preg_match('//u', $v)) {
$stub = new Stub();
Expand Down Expand Up @@ -148,15 +143,15 @@ protected function doClone($var)
$a = $v;
}

$stub->value = $zval['array_count'] ?: count($a);
$stub->value = count($a);
}
break;

case 'object':
if (empty($objRefs[$h = $zval['object_handle'] ?: ($hashMask ^ hexdec(substr(spl_object_hash($v), $hashOffset, PHP_INT_SIZE)))])) {
if (empty($objRefs[$h = $hashMask ^ hexdec(substr(spl_object_hash($v), $hashOffset, PHP_INT_SIZE))])) {
$stub = new Stub();
$stub->type = Stub::TYPE_OBJECT;
$stub->class = $zval['object_class'] ?: get_class($v);
$stub->class = get_class($v);
$stub->value = $v;
$stub->handle = $h;
$a = $this->castObject($stub, 0 < $i);
Expand Down Expand Up @@ -188,7 +183,7 @@ protected function doClone($var)
if (empty($resRefs[$h = (int) $v])) {
$stub = new Stub();
$stub->type = Stub::TYPE_RESOURCE;
if ('Unknown' === $stub->class = $zval['resource_type'] ?: @get_resource_type($v)) {
if ('Unknown' === $stub->class = @get_resource_type($v)) {
$stub->class = 'Closed';
}
$stub->value = $v;
Expand All @@ -211,7 +206,7 @@ protected function doClone($var)
}

if (isset($stub)) {
if ($zval['zval_isref']) {
if ($zvalIsRef) {
$refs[$k] = new Stub();
$refs[$k]->value = $stub;
$h = spl_object_hash($refs[$k]);
Expand Down Expand Up @@ -245,7 +240,7 @@ protected function doClone($var)
$stub->position = $len++;
}
$stub = $a = null;
} elseif ($zval['zval_isref']) {
} elseif ($zvalIsRef) {
$refs[$k] = $vals[$k] = new Stub();
$refs[$k]->value = $v;
$h = spl_object_hash($refs[$k]);
Expand Down

0 comments on commit c431fd9

Please sign in to comment.