private function serializeReturn(array $return)
    {
        $serializable = [];

        foreach ($return as $key => $value) {
            // No need to return magic variables
            if (Context::isSpecialVariableName($key)) {
                continue;
            }

            // Resources and Closures don't error, but they don't serialize well either.
            if (\is_resource($value) || $value instanceof \Closure) {
                continue;
            }

            try {
                @\serialize($value);
                $serializable[$key] = $value;
            } catch (\Throwable $e) {
                // we'll just ignore this one...
            } catch (\Exception $e) {
                // and this one too...
                // @todo remove this once we don't support PHP 5.x anymore :)
            }
        }

        return @\serialize($serializable);
    }