Commit 5a658211 authored by catch's avatar catch
Browse files

Issue #3429849 by longwave, andypost, spokje: Make doctrine/lexer:^3.0...

Issue #3429849 by longwave, andypost, spokje: Make doctrine/lexer:^3.0 compatible with \Drupal\Component\Annotation\Doctrine
parent 7cf46468
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -497,14 +497,14 @@
            "dist": {
                "type": "path",
                "url": "core",
                "reference": "9a3b93d8f495d3f101bcc2d39ce91695b57aece6"
                "reference": "7d2d6a32cdb382310276445d271aeb3348c5d103"
            },
            "require": {
                "asm89/stack-cors": "^2.3",
                "composer-runtime-api": "^2.1",
                "composer/semver": "^3.3",
                "doctrine/annotations": "^2.0",
                "doctrine/lexer": "^2.0",
                "doctrine/lexer": "^2 || ^3",
                "egulias/email-validator": "^3.2.1|^4.0",
                "ext-date": "*",
                "ext-dom": "*",
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@
        "revolt/event-loop": "^1.0",
        "twig/twig": "^3.21.0",
        "doctrine/annotations": "^2.0",
        "doctrine/lexer": "^2.0",
        "doctrine/lexer": "^2 || ^3",
        "guzzlehttp/guzzle": "^7.5",
        "guzzlehttp/psr7": "^2.4.5",
        "egulias/email-validator": "^3.2.1|^4.0",
+17 −17
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ private function syntaxError($expected, $token = null)
        $message  = sprintf('Expected %s, got ', $expected);
        $message .= ($this->lexer->lookahead === null)
            ? 'end of string'
            : sprintf("'%s' at position %s", $token['value'], $token['position']);
            : sprintf("'%s' at position %s", $token->value, $token->position);

        if (strlen($this->context)) {
            $message .= ' in ' . $this->context;
@@ -616,13 +616,13 @@ private function Annotations()
        $annotations = array();

        while (null !== $this->lexer->lookahead) {
            if (DocLexer::T_AT !== $this->lexer->lookahead['type']) {
            if (DocLexer::T_AT !== $this->lexer->lookahead->type) {
                $this->lexer->moveNext();
                continue;
            }

            // make sure the @ is preceded by non-catchable pattern
            if (null !== $this->lexer->token && $this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen($this->lexer->token['value'])) {
            if (null !== $this->lexer->token && $this->lexer->lookahead->position === $this->lexer->token->position + strlen($this->lexer->token->value)) {
                $this->lexer->moveNext();
                continue;
            }
@@ -630,8 +630,8 @@ private function Annotations()
            // make sure the @ is followed by either a namespace separator, or
            // an identifier token
            if ((null === $peek = $this->lexer->glimpse())
                || (DocLexer::T_NAMESPACE_SEPARATOR !== $peek['type'] && !in_array($peek['type'], self::$classIdentifiers, true))
                || $peek['position'] !== $this->lexer->lookahead['position'] + 1) {
                || (DocLexer::T_NAMESPACE_SEPARATOR !== $peek->type && !in_array($peek->type, self::$classIdentifiers, true))
                || $peek->position !== $this->lexer->lookahead->position + 1) {
                $this->lexer->moveNext();
                continue;
            }
@@ -988,17 +988,17 @@ private function Identifier()

        $this->lexer->moveNext();

        $className = $this->lexer->token['value'];
        $className = $this->lexer->token->value;

        while (
            null !== $this->lexer->lookahead &&
            $this->lexer->lookahead['position'] === ($this->lexer->token['position'] + strlen($this->lexer->token['value'])) &&
            $this->lexer->lookahead->position === ($this->lexer->token->position + strlen($this->lexer->token->value)) &&
            $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)
        ) {
            $this->match(DocLexer::T_NAMESPACE_SEPARATOR);
            $this->matchAny(self::$classIdentifiers);

            $className .= '\\' . $this->lexer->token['value'];
            $className .= '\\' . $this->lexer->token->value;
        }

        return $className;
@@ -1013,7 +1013,7 @@ private function Value()
    {
        $peek = $this->lexer->glimpse();

        if (DocLexer::T_EQUALS === $peek['type']) {
        if (DocLexer::T_EQUALS === $peek->type) {
            return $this->FieldAssignment();
        }

@@ -1039,18 +1039,18 @@ private function PlainValue()
            return $this->Constant();
        }

        switch ($this->lexer->lookahead['type']) {
        switch ($this->lexer->lookahead->type) {
            case DocLexer::T_STRING:
                $this->match(DocLexer::T_STRING);
                return $this->lexer->token['value'];
                return $this->lexer->token->value;

            case DocLexer::T_INTEGER:
                $this->match(DocLexer::T_INTEGER);
                return (int)$this->lexer->token['value'];
                return (int)$this->lexer->token->value;

            case DocLexer::T_FLOAT:
                $this->match(DocLexer::T_FLOAT);
                return (float)$this->lexer->token['value'];
                return (float)$this->lexer->token->value;

            case DocLexer::T_TRUE:
                $this->match(DocLexer::T_TRUE);
@@ -1078,7 +1078,7 @@ private function PlainValue()
    private function FieldAssignment()
    {
        $this->match(DocLexer::T_IDENTIFIER);
        $fieldName = $this->lexer->token['value'];
        $fieldName = $this->lexer->token->value;

        $this->match(DocLexer::T_EQUALS);

@@ -1146,14 +1146,14 @@ private function ArrayEntry()
    {
        $peek = $this->lexer->glimpse();

        if (DocLexer::T_EQUALS === $peek['type']
                || DocLexer::T_COLON === $peek['type']) {
        if (DocLexer::T_EQUALS === $peek->type
                || DocLexer::T_COLON === $peek->type) {

            if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) {
                $key = $this->Constant();
            } else {
                $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING));
                $key = $this->lexer->token['value'];
                $key = $this->lexer->token->value;
            }

            $this->matchAny(array(DocLexer::T_EQUALS, DocLexer::T_COLON));
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
    "require": {
        "php": ">=8.3.0",
        "doctrine/annotations": "^2.0",
        "doctrine/lexer": "^2.0",
        "doctrine/lexer": "^2 || ^3",
        "drupal/core-class-finder": "11.x-dev",
        "drupal/core-file-cache": "11.x-dev",
        "drupal/core-plugin": "11.x-dev",