From d603e884df649f2bee84e0aa97bdb7c6bb8cf424 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Fri, 9 May 2025 09:54:28 +0100 Subject: [PATCH 1/3] Add forward compatibility with doctrine/lexer 3. --- .../Annotation/Doctrine/DocParser.php | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php index 052542ecfca7..5fb3e2e3a75e 100644 --- a/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php +++ b/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php @@ -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)); -- GitLab From 2cc8f27cd19092c443a5bdd6e2474b4e9462efbf Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Fri, 9 May 2025 09:56:18 +0100 Subject: [PATCH 2/3] Allow both versions. --- composer.lock | 44 +++++++++++++++++-- core/composer.json | 2 +- .../Drupal/Component/Annotation/composer.json | 2 +- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f9484b94396e..737d4c25fe99 100644 --- a/composer.lock +++ b/composer.lock @@ -497,14 +497,14 @@ "dist": { "type": "path", "url": "core", - "reference": "3fe3a026102b1fb6c77111c00ec61a34a42f3645" + "reference": "f99466c9fb14f9c9e66df8f82662a508abecc051" }, "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": "*", @@ -689,6 +689,42 @@ "relative": true } }, + { + "name": "drupal/core-recipe-unpack", + "version": "11.x-dev", + "dist": { + "type": "path", + "url": "composer/Plugin/RecipeUnpack", + "reference": "42e58be1818866167bc27d4fce206dc1d7a40d4c" + }, + "require": { + "composer-plugin-api": "^2", + "php": ">=8.3" + }, + "require-dev": { + "composer/composer": "^2.7" + }, + "type": "composer-plugin", + "extra": { + "class": "Drupal\\Composer\\Plugin\\RecipeUnpack\\Plugin" + }, + "autoload": { + "psr-4": { + "Drupal\\Composer\\Plugin\\RecipeUnpack\\": "" + } + }, + "license": [ + "GPL-2.0-or-later" + ], + "description": "A Composer project unpacker for Drupal recipes.", + "homepage": "https://www.drupal.org/project/drupal", + "keywords": [ + "drupal" + ], + "transport-options": { + "relative": true + } + }, { "name": "drupal/core-vendor-hardening", "version": "11.x-dev", @@ -9862,8 +9898,8 @@ }, "prefer-stable": true, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.3.0" }, diff --git a/core/composer.json b/core/composer.json index 59bca714e5b9..959f646d5363 100644 --- a/core/composer.json +++ b/core/composer.json @@ -37,7 +37,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", diff --git a/core/lib/Drupal/Component/Annotation/composer.json b/core/lib/Drupal/Component/Annotation/composer.json index 3575798a7c15..24977f8da9f7 100644 --- a/core/lib/Drupal/Component/Annotation/composer.json +++ b/core/lib/Drupal/Component/Annotation/composer.json @@ -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", -- GitLab From a6760016670cb8e232db19fd327307a03285ad32 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Fri, 9 May 2025 09:56:52 +0100 Subject: [PATCH 3/3] composer update doctrine/lexer --- composer.lock | 119 +++++++++--------- .../Metapackage/CoreRecommended/composer.json | 3 +- .../PinnedDevDependencies/composer.json | 1 + 3 files changed, 61 insertions(+), 62 deletions(-) diff --git a/composer.lock b/composer.lock index 737d4c25fe99..64d8111764e7 100644 --- a/composer.lock +++ b/composer.lock @@ -365,78 +365,29 @@ }, "time": "2024-09-05T10:17:24+00:00" }, - { - "name": "doctrine/deprecations", - "version": "1.1.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "phpunit/phpunit": "<=7.5 || >=13" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^12 || ^13", - "phpstan/phpstan": "1.4.10 || 2.1.11", - "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", - "psr/log": "^1 || ^2 || ^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.5" - }, - "time": "2025-04-07T20:06:18+00:00" - }, { "name": "doctrine/lexer", - "version": "2.1.1", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6" + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", - "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.21" + "vimeo/psalm": "^5.21" }, "type": "library", "autoload": { @@ -473,7 +424,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.1" + "source": "https://github.com/doctrine/lexer/tree/3.0.1" }, "funding": [ { @@ -489,7 +440,7 @@ "type": "tidelift" } ], - "time": "2024-02-05T11:35:39+00:00" + "time": "2024-02-05T11:56:58+00:00" }, { "name": "drupal/core", @@ -5443,6 +5394,54 @@ }, "time": "2023-01-05T11:28:13+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=13" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^13", + "phpstan/phpstan": "1.4.10 || 2.1.11", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + }, + "time": "2025-04-07T20:06:18+00:00" + }, { "name": "doctrine/instantiator", "version": "2.0.0", diff --git a/composer/Metapackage/CoreRecommended/composer.json b/composer/Metapackage/CoreRecommended/composer.json index bc11c39d9b80..d4c1914cb18f 100644 --- a/composer/Metapackage/CoreRecommended/composer.json +++ b/composer/Metapackage/CoreRecommended/composer.json @@ -11,8 +11,7 @@ "asm89/stack-cors": "~v2.3.0", "composer/semver": "~3.4.3", "doctrine/annotations": "~2.0.2", - "doctrine/deprecations": "~1.1.5", - "doctrine/lexer": "~2.1.1", + "doctrine/lexer": "~3.0.1", "egulias/email-validator": "~4.0.4", "guzzlehttp/guzzle": "~7.9.3", "guzzlehttp/promises": "~2.2.0", diff --git a/composer/Metapackage/PinnedDevDependencies/composer.json b/composer/Metapackage/PinnedDevDependencies/composer.json index 5518fa7cbafd..6d46ea8e0574 100644 --- a/composer/Metapackage/PinnedDevDependencies/composer.json +++ b/composer/Metapackage/PinnedDevDependencies/composer.json @@ -20,6 +20,7 @@ "composer/spdx-licenses": "1.5.8", "composer/xdebug-handler": "3.0.5", "dealerdirect/phpcodesniffer-composer-installer": "v1.0.0", + "doctrine/deprecations": "1.1.5", "doctrine/instantiator": "2.0.0", "drupal/coder": "8.3.26", "google/protobuf": "v4.30.2", -- GitLab