Core\Debug
Shows any value in a readable form while you debug a program. It can print the value to stderr or return it as a string.
Core\Debug::dump renders each argument as a typed record — int(42), string(2) "42", an array as array(n) [ … ] with its keys, an object as Class#id (n) { … } with its declared properties — and writes one per argument to the diagnostic channel: stderr in a CLI program, never stdout, and never into a Core\Out::capture. render answers the same text as a Core\Cli\Text without the trailing newline, so it can be echoed. A cycle is marked [cycle -> #1], a control byte is made visible, a secret property renders as [redacted], and the rendering is deterministic.
recordIfArmed names a point in your code. It returns true only while a developer runs a capture for that point in the debug viewer, and the request is then recorded.
<?nvsclass Point{ public function constructor(public int $x, public int $y) {}}echo Core\Debug::render(42), "\n";echo Core\Debug::render('42'), "\n";echo Core\Debug::render(null), "\n";array<int> $list = [10, 20];echo Core\Debug::render($list), "\n";array<string> $map = ['a' => 'x', 'b' => 'y'];echo Core\Debug::render($map), "\n";echo Core\Debug::render(new Point(1, 2)), "\n";Core\Debug::dump($list);echo "the dump went to stderr\n";int(42)string(2) "42"nullarray(2) [ 0 => int(10) 1 => int(20)]array(2) [ "a" => string(1) "x" "b" => string(1) "y"]Point#1 (2) { $x => int(1) $y => int(2)}the dump went to stderrMembers
10 members.
| Member | Signature |
|---|---|
dump | dump(mixed ...$values): void |
render | render(mixed $value): Core\Cli\Text |
startCoverage | startCoverage(bool $branches = false): void |
stopCoverage | stopCoverage(): void |
coverage | coverage(): array<array<int>> |
startTrace | startTrace(string $path): void |
recordIfArmed | recordIfArmed(string $point): bool |
stopTrace | stopTrace(): void |
startProfile | startProfile(string $path): void |
stopProfile | stopProfile(): void |
