Skip to content

Document new VarCloner::setMinDepth function #8155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions components/var_dumper/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,23 @@ Before calling :method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::cloneV
you can configure these limits:

:method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxItems`
configures the maximum number of items that will be cloned
*past the first nesting level*. Items are counted using a breadth-first
Configures the maximum number of items that will be cloned
*past the minimum nesting depth*. Items are counted using a breadth-first
algorithm so that lower level items have higher priority than deeply nested
items;
items. Specifying ``-1`` removes the limit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph changes should target 3.2 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph still accurately describes behavior of older versions. For versions < 3.4 we can assume the minimum nesting depth is hard-coded to 1; this is indicated by the next paragraph that says "The default value is 1, which is consistent with older Symfony versions." The presence of setMaxItems is much older than v3.2 - it goes back to Symfony 2 (maybe back to the original introduction of VarCloner).


:method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxString`
configures the maximum number of characters that will be cloned before
cutting overlong strings;
:method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMinDepth`
.. versionadded:: 3.4
The ``setMinDepth()`` method was introduced in Symfony 3.4.

Configures the minimum tree depth where we are guaranteed to clone
all the items. After this depth is reached, only ``setMaxItems``
items will be cloned. The default value is ``1``, which is consistent
with older Symfony versions.

In both cases, specifying ``-1`` removes any limit.
:method:`Symfony\\Component\\VarDumper\\Cloner\\VarCloner::setMaxString`
Configures the maximum number of characters that will be cloned before
cutting overlong strings. Specifying ``-1`` removes the limit.

Before dumping it, you can further limit the resulting
:class:`Symfony\\Component\\VarDumper\\Cloner\\Data` object using the following methods:
Expand Down