Skip to content

Commit b8ab8f7

Browse files
committed
feature #14006 [VarDumper] with-er interface for Cloner\Data (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [VarDumper] with-er interface for Cloner\Data | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#5106 I should have this idea earlier... :) Commits ------- 2462c5b [VarDumper] with-er interface for Cloner\Data
2 parents 5848bcc + b72681c commit b8ab8f7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

DataCollector/DumpDataCollector.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1)
168168
$dumps = array();
169169

170170
foreach ($this->data as $dump) {
171-
$dumper->dump($dump['data']->getLimitedClone($maxDepthLimit, $maxItemsPerDepth));
171+
if (method_exists($dump['data'], 'withMaxDepth')) {
172+
$dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth));
173+
} else {
174+
// getLimitedClone is @deprecated, to be removed in 3.0
175+
$dumper->dump($dump['data']->getLimitedClone($maxDepthLimit, $maxItemsPerDepth));
176+
}
172177
rewind($data);
173178
$dump['data'] = stream_get_contents($data);
174179
ftruncate($data, 0);

0 commit comments

Comments
 (0)