Open juslintek opened 4 years ago
Thanks for your request, I'm trying to find a way to implement die()
.
use Symfony\Component\VarDumper\Caster\ReflectionCaster;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
if (!function_exists('dd')) {
function dd()
{
static $cloner, $dumper;
if (null === $cloner) {
$cloner = new VarCloner();
$cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
if (app()->offsetExists('swoole') && app('swoole')->worker_id < app('swoole')->setting['worker_num']) {
$dumper = new HtmlDumper();
} else {
$dumper = new CliDumper();
}
}
if ($dumper instanceof HtmlDumper) {
$dumper->setStyles([]);
}
foreach (func_get_args() as $var) {
$dumper->dump($cloner->cloneVar($var));
}
// how to die ?
}
}
This has been added by https://github.com/swooletw/laravel-swoole/issues/254 You can even override dd: https://gist.github.com/chrisliuqq/96de1ef8160a1d41b6af315c6fb611f3