public static function registerCaster(AbstractCloner $cloner)
    {
        /**
         * Don't want this to be publicly accessible.
         *
         * @param TransparentProxyTrait $obj
         * @param array                 $a
         * @param Stub                  $stub
         * @param bool                  $isNested
         * @param int                   $filter
         *
         * @return array
         */
        $caster = static function ($obj, array $a, Stub $stub, $isNested, $filter) {
            if (!$obj->transparent) {
                return $a;
            }

            // Fake the class name
            $stub->class = $obj->getProxiedClass();

            $object = $obj->getProxiedObject();
            if (is_array($object)) {
                // Fake to look like array
                $a = $object;
                $stub->type = Stub::TYPE_ARRAY;
                $stub->class = Stub::ARRAY_ASSOC;
                $stub->value = count($a);
                $stub->handle = 0;
            } else {
                // Fake to look like inner object
                $refCls = new \ReflectionClass($object);
                $a = Caster::castObject($object, $refCls);

                // Fake handle to inner object handle
                (new VarCloner([
                    $refCls->getName() => function ($obj, $a, Stub $innerStub) use ($stub) {
                        $stub->handle = $innerStub->handle;
                    },
                ]))->cloneVar($object);
            }

            return $a;
        };

        $cloner->addCasters([
            static::class => $caster,
        ]);
    }