DebugValue
API reference › Debug Core › Storage › DebugValue
Represents an arbitrary PHP value as JSON-safe tagged data.
Hydration deliberately recreates this value object rather than executable objects, resources, or closures.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$className readonly constructor | string| | Captured object class or null for non-object values. Default: null. | DebugValue |
$entries readonly constructor | list<array{keyType: "int"| | Captured child values. Default: []. | DebugValue |
$reason readonly constructor | string| | Truncation or unsupported-value reason, or null when not applicable. Default: null. | DebugValue |
$resourceType readonly constructor | string| | Captured resource type or null for non-resource values. Default: null. | DebugValue |
$type readonly constructor | string | Tagged value type. | DebugValue |
$value readonly constructor | bool| | Captured scalar value or display label. Default: null. | DebugValue |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
capture() static | Captures an arbitrary PHP value as JSON-safe tagged data. | DebugValue |
fromArray() static | Hydrates 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 |
Method details
Section titled “Method details”capture()
Section titled “capture() ”public static function capture(mixed $value): selfCaptures an arbitrary PHP value as JSON-safe tagged data.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | mixed | PHP value to capture. |
Returns
self: Tagged debug value.
fromArray()
Section titled “fromArray() ”public static function fromArray(mixed $data, string $path = '$'): selfHydrates a tagged debug value from decoded JSON data.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | mixed | Decoded tagged value. |
$path | string | Payload path used in hydration errors. |
Returns
self: Hydrated debug value.
jsonSerialize()
Section titled “jsonSerialize() ”public function jsonSerialize(): array<string, mixed>Returns the tagged value for JSON serialization.
Returns
array<string, mixed>: Tagged debug value payload.
toDisplayEntries()
Section titled “toDisplayEntries() ”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.
toDisplayValue()
Section titled “toDisplayValue() ”public function toDisplayValue(): mixedReturns a safe PHP representation suitable for existing dump and table renderers.
Returns
mixed: Display-safe PHP value.