public static function unexpectedCharacter(Input $definition, array $expected = []): self
    {
        $pointer = self::createPointerString($definition->getInput(), $definition->getIndex());

        if (empty($expected)) {
            return new self("Unexpected character:\n$pointer");
        }

        $expected = $expected ?? $definition->getLatestExpectations();

        $expected = array_map(function (string $e) {
            return "'$e'";
        }, $expected);

        $expected = implode(", ", $expected);

        return new self("Unexpected character (expected $expected):\n$pointer");
    }
public static function unexpectedCharacter(Input $definition, array $expected = []): self
    {
        $pointer = self::createPointerString($definition->getInput(), $definition->getIndex());

        if (empty($expected)) {
            return new self("Unexpected character:\n$pointer");
        }

        $expected = $expected ?? $definition->getLatestExpectations();

        $expected = array_map(function (string $e) {
            return "'$e'";
        }, $expected);

        $expected = implode(", ", $expected);

        return new self("Unexpected character (expected $expected):\n$pointer");
    }
public static function unexpectedCharacter ( Input $ definition , array $ expected = [ ] ) : self { $ pointer = self :: createPointerString ( $ definition -> getInput ( ) , $ definition -> getIndex ( ) ) ; if ( empty ( $ expected ) ) { return new self ( "Unexpected character:\n$pointer" ) ; } $ expected = $ expected ?? $ definition -> getLatestExpectations ( ) ; $ expected = array_map ( function ( string $ e ) { return "'$e'" ; } , $ expected ) ; $ expected = implode ( ", " , $ expected ) ; return new self ( "Unexpected character (expected $expected):\n$pointer" ) ; }
Invalid route definition with unexpected character.

@param Input $definition
@param string[] $expected
@return InvalidRoute
Invalid route definition with unexpected character .