Skip to content
PHP Ecosystem
Explore

DebugArray

API reference › Debug Core › Storage › DebugArray

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

Represents a PHP array with arbitrary nested values as JSON-safe debug data.

MethodDescriptionDefined by
capture() staticCaptures an array as tagged debug data.DebugArray
fromArray() staticHydrates a tagged debug array from decoded JSON data.DebugArray
jsonSerialize()Returns the tagged array for JSON serialization.DebugArray
values()Returns captured entries as display-safe PHP values.DebugArray
public static function capture(array<array-key, mixed> $value): self

Captures an array as tagged debug data.

Parameters

ParameterTypeDescription
$valuearray<array-key, mixed>PHP values to capture.

Returns

self: Tagged array facade.

public static function fromArray(mixed $value, string $path): self

Hydrates a tagged debug array from decoded JSON data.

Parameters

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

Returns

self: Hydrated array facade.

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

Returns the tagged array for JSON serialization.

Returns

array<string, mixed>: Tagged array payload.

public function values(): array<array-key, mixed>

Returns captured entries as display-safe PHP values.

Returns

array<array-key, mixed>: Display-safe PHP values.