ThrowingCasterException example

$a = Caster::castObject($obj$class$hasDebugInfo$stub->class);

        try {
            while ($i--) {
                if (!empty($this->casters[$p = $parents[$i]])) {
                    foreach ($this->casters[$p] as $callback) {
                        $a = $callback($obj$a$stub$isNested$this->filter);
                    }
                }
            }
        } catch (\Exception $e) {
            $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
        }

        return $a;
    }

    /** * Casts a resource to an array representation. * * @param bool $isNested True if the object is nested in the dumped structure */
    protected function castResource(Stub $stub, bool $isNested): array
    {
$a = Caster::castObject($obj$class$hasDebugInfo$stub->class);

        try {
            while ($i--) {
                if (!empty($this->casters[$p = $parents[$i]])) {
                    foreach ($this->casters[$p] as $callback) {
                        $a = $callback($obj$a$stub$isNested$this->filter);
                    }
                }
            }
        } catch (\Exception $e) {
            $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
        }

        return $a;
    }

    /** * Casts a resource to an array representation. * * @param bool $isNested True if the object is nested in the dumped structure */
    protected function castResource(Stub $stub, bool $isNested): array
    {
Home | Imprint | This part of the site doesn't use cookies.