Skip to content

Commit cb0ee89

Browse files
§ about Data::getLimitedClone()
1 parent ee2d7e4 commit cb0ee89

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

components/var_dumper/advanced.rst

+17
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ Before cloning, you can configure the limits with::
2727

2828
They will be applied when calling ``->cloneVar()`` afterwards.
2929

30+
Before dumping it, you can further limit the resulting
31+
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object by calling its
32+
:method:`Symfony\\Component\\VarDumper\\Cloner\\Data::getLimitedClone`
33+
method:
34+
- the first `$maxDepth` argument allows limiting dumps in the depth dimension,
35+
- the second `$maxItemsPerDepth` limits the number of items per depth level,
36+
- and the last `$useRefHandles` defaults to `true` but allows removing internal
37+
objects' handles for sparser output,
38+
- but unlike the previous limits on cloners that remove data on purpose, these
39+
limits can be changed back and forth before dumping since they do not affect
40+
the intermediate representation internally.
41+
42+
.. note::
43+
When no limit is applied, a :class:`Symfony\\Component\\VarDumper\\Cloner\\Data`
44+
object is as accurate as the native :phpfunction:`serialize` function and thus
45+
could have a wider purpose than strictly dumping for debugging.
46+
3047
Dumpers
3148
~~~~~~~
3249

0 commit comments

Comments
 (0)