Skip to content

Commit 452dea9

Browse files
author
Robin Chalas
committed
Make dump() variadic
1 parent 3e0501a commit 452dea9

File tree

1 file changed

+6
-2
lines changed
  • src/Symfony/Component/VarDumper/Resources/functions

1 file changed

+6
-2
lines changed

src/Symfony/Component/VarDumper/Resources/functions/dump.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
/**
1616
* @author Nicolas Grekas <p@tchwork.com>
1717
*/
18-
function dump($var)
18+
function dump(...$vars)
1919
{
20-
foreach (func_get_args() as $var) {
20+
if (!$vars) {
21+
throw new ArgumentCountError('dump() requires at least 1 argument.');
22+
}
23+
24+
foreach ($vars as $var) {
2125
VarDumper::dump($var);
2226
}
2327
}

0 commit comments

Comments
 (0)