<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Twig;

/**
 * Marks a content as safe.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Markup implements \Countable, \JsonSerializable
{
    private $content;
    private $charset;

    public function __construct($content, $charset)
    {
        $this->content = (string) $content;
        $this->charset = $charset;
    }

    public function __toString()
    {
        return $this->content;
    }

    /**
     * @return int
     */
    public function count()
    {
        return mb_strlen($this->content, $this->charset);
    }

    public function jsonSerialize()
    {
        return $this->content;
    }
}

class_alias('Twig\Markup', 'Twig_Markup');

<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Twig;

/**
 * Marks a content as safe.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Markup implements \Countable, \JsonSerializable
{
    private $content;
    private $charset;

    public function __construct($content, $charset)
    {
        $this->content = (string) $content;
        $this->charset = $charset;
    }

    public function __toString()
    {
        return $this->content;
    }

    /**
     * @return int
     */
    public function count()
    {
        return mb_strlen($this->content, $this->charset);
    }

    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
        return $this->content;
    }
}

class_alias('Twig\Markup', 'Twig_Markup');

Add ReturnTypeWillChange to JsonSerializable implementation
Add ReturnTypeWillChange to JsonSerializable implementation

Signed-off-by: Alexander M. Turek <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@derrabus.de>
