feature #26970 [VarDumper] Add dd() helper == dump() + exit() (nicolas-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
-------

a55916a895 [VarDumper] Add dd() helper == dump() + die()
This commit is contained in:
Fabien Potencier 2018-04-19 07:17:41 +02:00
commit a59d0f615c

View File

@ -30,3 +30,16 @@ if (!function_exists('dump')) {
return $var;
}
}
if (!function_exists('dd')) {
function dd($var, ...$moreVars)
{
VarDumper::dump($var);
foreach ($moreVars as $var) {
VarDumper::dump($var);
}
exit(1);
}
}