Skip to content

Commit

Permalink
detect html varDump
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed May 27, 2024
1 parent 996162c commit fce5b8e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function varDump(): VarDumpInterface
try {
return VarDumpInstance::get();
} catch (LogicException $e) {
return varDumpConsole();
return PHP_SAPI === 'cli'
? varDumpConsole()
: varDumpHtml();
}
}

Expand All @@ -71,7 +73,7 @@ function writers(): WritersInterface
} catch (LogicException $e) {
return (new Writers())
->withOutput(
new StreamWriter(streamFor('php://stdout', 'r+'))
new StreamWriter(streamFor('php://output', 'w'))
)
->withError(
new StreamWriter(streamFor('php://stderr', 'r+'))
Expand Down

0 comments on commit fce5b8e

Please sign in to comment.