Plugin annotations should support PHP attributes

Created on 30 May 2025, 10 days ago

Problem/Motivation

As part of the 10.2 and PHP 8 support , the plugin types should also support PHP attributes.

Proposed resolution

Follow the instructions in https://www.drupal.org/node/3395582 and add support for annotations.

Remaining tasks

Provide issue fork/patch.

User interface changes

N/A

API changes

N/A. It should be backwards compatible.

📌 Task
Status

Active

Version

4.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @codebymikey
  • Pipeline finished with Failed
    10 days ago
    Total: 162s
    #510412
  • Pipeline finished with Success
    10 days ago
    Total: 190s
    #510424
  • Pipeline finished with Success
    8 days ago
    Total: 272s
    #511387
  • Pipeline finished with Failed
    8 days ago
    Total: 324s
    #511403
  • Pipeline finished with Success
    8 days ago
    Total: 328s
    #511411
  • Pipeline finished with Success
    8 days ago
    Total: 305s
    #511415
  • Pipeline finished with Success
    8 days ago
    Total: 294s
    #511429
  • Pipeline finished with Success
    7 days ago
    Total: 154s
    #512000
  • Pipeline finished with Success
    7 days ago
    Total: 150s
    #512020
  • Pipeline finished with Success
    7 days ago
    Total: 154s
    #512026
  • 🇮🇹Italy itamair

    thanks @codebymikey for moving ahead on all this ... that looks definitely wise and opportune.
    I opened a review to you MR and left some comments.

    A couple of other questions and considerations:
    - did you QA & Test your new implementation? Does it work properly without introducing any regression to the 8.x-4.x-dev branch?
    - do you really think we should introduce all these new Attributes pattern still keeping the Annotations classes and backword compatibility for Drupal Core versions < 10.2?
    Wouldn't be better to spin a new major Geocoder release that supports only "^10 || ^11" and remove all the Annotations? (not to maintain parallels patterns)?

  • Pipeline finished with Success
    6 days ago
    Total: 168s
    #513021
  • did you QA & Test your new implementation? Does it work properly without introducing any regression to the 8.x-4.x-dev branch?

    Yes, and that was why I introduced the tests for Drupal 9.5 so it was easier to confirm the behaviour.

    do you really think we should introduce all these new Attributes pattern still keeping the Annotations classes and backword compatibility for Drupal Core versions < 10.2?

    I did briefly consider this, but given that Drupal 9.5 was still supported even after the work with Drupal 10 compatibility: changing php-http/guzzle6-adapter dependency into php-http/guzzle7-adapter RTBC , I thought there might've been a reason (e.g an ideology on the project's side to support as many Drupal versions as necessary), and didn't think it necessitated releasing a major release just for a new plugin discovery method whilst it was still fairly trivial to keep backwards-compatibility.

    I think it would be cleaner, but as per the Drupal change record, annotation support is still supported until D12, so it seemed easier to keep compatibility for now whilst giving other contrib/custom modules time to switch to the attribute-based definitions, then when support for

  • 🇮🇹Italy itamair

    Thanks for your last fixes and all the provided explanations.
    I am still not convinced that we should introduce the Plugin Attributes and still keep BC with Annotations and Drupal Core < 10.2.
    At least we still have time to implement this, as (ref: https://www.drupal.org/project/drupal_cms/issues/3501710 🌱 Drupal 12.0 compatibility planning Active )

    Drupal 12 will be released at the earliest in June 2026 which is in 15 months

    and probably we would rather deploy a new release in some months that would drop support to Drupal Core < 10.2
    (and be cleaned up with all the Annotations Plugins code).
    Let me still think about all this for some days ... and let's see if you or another community member has stronger opinion on all this.
    Let's still keep this in "Needs review" for other comments ...

Production build 0.71.5 2024