private function castObjectClass(): object
    {
        return new class($this->options) {
            /**
             * Console formatter configuration.
             *
             * @var array
             */
            private $options;

            public function __construct(array $options)
            {
                $this->options = $options;
            }

            /**
             * @param mixed                                    $value
             * @param array                                    $array
             * @param \Symfony\Component\VarDumper\Cloner\Stub $stub
             * @param mixed                                    $isNested
             *
             * @return array
             */
            public function castObject($value, array $array, Stub $stub, $isNested): array
            {
                if ($this->options['multiline']) {
                    return $array;
                }

                if ($isNested && ! $value instanceof DateTimeInterface) {
                    $stub->cut = -1;
                    $array     = [];
                }

                return $array;
            }
        };
    }