Skip to content
PHP Ecosystem
Explore

DebugValue

API reference › Debug Core › Storage › DebugValue

final readonly classPHPForge\Debug\Storage\DebugValue
ImplementsJsonSerializable
Sourcesrc/Storage/DebugValue.php

Represents an arbitrary PHP value as JSON-safe tagged data.

Hydration deliberately recreates this value object rather than executable objects, resources, or closures.

PropertyTypeDescriptionDefined by
$className readonly constructorstring|nullCaptured object class or null for non-object values. Default: null.DebugValue
$entries readonly constructorlist<array{keyType: "int"|"string", key: int|string, value: self}>Captured child values. Default: [].DebugValue
$reason readonly constructorstring|nullTruncation or unsupported-value reason, or null when not applicable. Default: null.DebugValue
$resourceType readonly constructorstring|nullCaptured resource type or null for non-resource values. Default: null.DebugValue
$type readonly constructorstringTagged value type.DebugValue
$value readonly constructorbool|float|int|string|nullCaptured scalar value or display label. Default: null.DebugValue
MethodDescriptionDefined by
capture() staticCaptures an arbitrary PHP value as JSON-safe tagged data.DebugValue
fromArray() staticHydrates a tagged debug value from decoded JSON data.DebugValue
jsonSerialize()Returns the tagged value for JSON serialization.DebugValue
toDisplayEntries()Returns the entries as a plain PHP array, keeping the key types captured from the original value.DebugValue
toDisplayValue()Returns a safe PHP representation suitable for existing dump and table renderers.DebugValue
public static function capture(mixed $value): self

Captures an arbitrary PHP value as JSON-safe tagged data.

Parameters

ParameterTypeDescription
$valuemixedPHP value to capture.

Returns

self: Tagged debug value.

public static function fromArray(mixed $data, string $path = '$'): self

Hydrates a tagged debug value from decoded JSON data.

Parameters

ParameterTypeDescription
$datamixedDecoded tagged value.
$pathstringPayload path used in hydration errors.

Returns

self: Hydrated debug value.

public function jsonSerialize(): array<string, mixed>

Returns the tagged value for JSON serialization.

Returns

array<string, mixed>: Tagged debug value payload.

public function toDisplayEntries(): array<int|string, mixed>

Returns the entries as a plain PHP array, keeping the key types captured from the original value.

Returns

array<int|string, mixed>: Display-safe child values retaining captured key types.

public function toDisplayValue(): mixed

Returns a safe PHP representation suitable for existing dump and table renderers.

Returns

mixed: Display-safe PHP value.