Skip to content

Commit

Permalink
feature #26970 [VarDumper] Add dd() helper == dump() + exit() (nicola…
Browse files Browse the repository at this point in the history
…s-grekas)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[VarDumper] Add dd() helper == dump() + exit()

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

By popular demand, I feel like we should reconsider our refusal for a `dd()` global helper.
For past references, see #26965, #26906, #13657, #17267, #19096.

Commits
-------

a55916a [VarDumper] Add dd() helper == dump() + die()
  • Loading branch information
fabpot committed Apr 19, 2018
2 parents 4429c9b + a55916a commit a59d0f6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Symfony/Component/VarDumper/Resources/functions/dump.php
Expand Up @@ -30,3 +30,16 @@ function dump($var, ...$moreVars)
return $var;
}
}

if (!function_exists('dd')) {
function dd($var, ...$moreVars)
{
VarDumper::dump($var);

foreach ($moreVars as $var) {
VarDumper::dump($var);
}

exit(1);
}
}

0 comments on commit a59d0f6

Please sign in to comment.