cloneVar($data); if ($output instanceof StreamOutput) { // When stream output is used the dumper is smart enough to // determine whether or not to apply colors to the dump. // @see Symfony\Component\VarDumper\Dumper\CliDumper::supportsColors $dumper->dump($cloned_data, $output->getStream()); } else { // @todo Use dumper return value to get output once we stop support // VarDumper v2. $stream = fopen('php://memory', 'r+b'); $dumper->dump($cloned_data, $stream); $output->writeln(stream_get_contents($stream, -1, 0)); fclose($stream); } } }