Problem/Motivation

We previously forked part of Doctrine's doctrine/annotations package into core at \Drupal\Component\Annotation\Doctrine.

The DocParser class depends on doctrine/lexer but this is only implicitly declared via a dependency on doctrine/annotations. However, the code is only compatible with version 2 of doctrine/lexer and upgrading to v3 results in a fatal error.

Steps to reproduce

$ composer update doctrine/lexer
$ drush cr
PHP Fatal error:  Uncaught Error: Cannot use object of type Doctrine\Common\Lexer\Token as array in /var/www/html/drupal/core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php:619

Proposed resolution

Add an explicit dependency on doctrine/lexer:^2.0 to both the Annotation component and core itself.
In a followup, upgrade this to doctrine/lexer:^3.0 for Drupal 11.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#7 3429602-nr-bot.txt1.01 KBneeds-review-queue-bot

Issue fork drupal-3429602

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

longwave created an issue. See original summary.

longwave’s picture

Title: Annotation component has an undeclared dependency on doctrine/lexer » Annotation component has an undeclared dependency on doctrine/lexer 2

longwave’s picture

Status: Active » Needs review
longwave’s picture

Component: base system » composer
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.01 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

nod_’s picture

Status: Needs work » Needs review

testbot is having issues

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Reasoning makes sense, so do the code changes.

spokje’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2a25e95 and pushed to 11.x. Thanks!

Drupal 10 is on v1 of annotations I don't think we need to backport there.

  • alexpott committed 2a25e951 on 11.x
    Issue #3429602 by longwave: Annotation component has an undeclared...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.