Add Debug\isStringable()
@@ -13,6 +13,7 @@ declare(strict_types=1);
namespace Swow\Debug;
+use Stringable;
use Swow\Coroutine;
use Swow\Util\FileSystem\IOException;
use Swow\Util\Handler;
@@ -22,6 +23,7 @@ use function fclose;
use function fgets;
use function fopen;
use function fwrite;
+use function is_scalar;
use function ob_get_clean;
use function ob_start;
use function rtrim;
@@ -32,6 +34,11 @@ use const DEBUG_BACKTRACE_IGNORE_ARGS;
use const PHP_EOL;
use const STDERR;
+function isStringable(mixed $value): bool
+{
+ return $value === null || is_scalar($value) || $value instanceof Stringable;
+}
+
function var_dump_return(mixed ...$expressions): string
{
ob_start();
