Skip to content

[VarDumper] dd() helper method tip #9665

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 2 commits into from
May 5, 2018
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
14 changes: 12 additions & 2 deletions components/var_dumper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ current PHP SAPI:
#. From time to time, run ``composer global update symfony/var-dumper``
to have the latest bug fixes.

.. tip::

The VarDumper component also includes a ``dd()`` helper method. This "dump
Copy link
Member

Choose a reason for hiding this comment

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

I'm not entirely happy with my reword. Let's ask our native speaker @weaverryan to review this short paragraph. Thanks!

and die" feature calls ``dump()`` and stops the application immediately
after with ``exit()``.

.. versionadded:: 4.1
The ``dd()`` helper method was introduced in Symfony 4.1.

DebugBundle and Twig Integration
--------------------------------

Expand All @@ -93,8 +102,9 @@ of your application may just break it by e.g. sending HTTP headers or
corrupting your view, the bundle configures the ``dump()`` function so that
variables are dumped in the web debug toolbar.

But if the toolbar cannot be displayed because you e.g. called ``die``/``exit``
or a fatal error occurred, then dumps are written on the regular output.
But if the toolbar cannot be displayed because you e.g. called
``die()``/``exit()``/``dd()`` or a fatal error occurred, then dumps are written
on the regular output.

In a Twig template, two constructs are available for dumping a variable.
Choosing between both is mostly a matter of personal taste, still:
Expand Down