Convert Action to use attributes instead of doctrine annotations

Created on 8 December 2023, 11 months ago
Updated 25 January 2024, 10 months ago

Problem/Motivation

From Drupal 10.2, Doctrine Annotations are being replaced with PHP8.0 Attributes, PHP8.1 New in initializers and Readonly properties.

@see 📌 Use PHP attributes instead of doctrine annotations Fixed
@see CN: Plugin implementations should use PHP attributes instead of annotations

This module has an Action which is a supported Plugin type.

Steps to reproduce

  1. Install Genpass on Drupal 10.2 or greater, with patch to trigger deprecation notices
  2. Review log messages to find Using Action annotation for plugin with ID genpass_set_random_password is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use a Drupal\Core\Action\Attribute\Action attribute instead. See https://www.drupal.org/project/drupal/issues/3252386 which was triggered during discovery.

NB: Need to patch core with 📌 Triggering deprecations for plugins using annotations when core plugin type has been converted to attributes Needs work to trigger deprecation notices and this doesn't quite work yet.

Proposed resolution

  • Create new 2.1.x branch
  • Drop support for D9, raising support to ^10.2
  • Convert Drupal\genpass\Plugin\Action\UserSetRandomPassword to use Attribute instead of Annotation
  • Update gitlab tests so that it doesn't check major or minor previous
  • Update gitlab tests on 2.0.x branch to that it doesn't check major or minor next

Remaining tasks

  • ✅ File an issue
  • ➖ Addition/Change/Update/Fix
  • ➖ Testing to ensure no regression
  • ➖ Automated unit testing coverage
  • ➖ Automated functional testing coverage
  • ➖ UX/UI designer responsibilities
  • ➖ Readability
  • ➖ Accessibility
  • ➖ Performance
  • ➖ Security
  • ➖ Documentation
  • ➖ Code review by maintainers
  • ➖ Full testing and approval
  • ➖ Credit contributors
  • ➖ Review with the product owner
  • ➖ Release notes snippet
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • @todo
📌 Task
Status

Fixed

Version

2.1

Component

Code

Created by

🇦🇺Australia elc

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

Merge Requests

Comments & Activities

  • Issue created by @elc
  • 🇦🇺Australia elc

    Move to correct branch now that 2.1.x-dev is available.

  • Merge request !19[#3407047] Convert Action Annotation to Attribute → (Merged) created by elc
  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • 🇦🇺Australia elc

    Once merged this would stay as just a dev release until 10.2 is released, at which point this would become the recommended branch.

    Ended up adding D11 support since that is being tested in the current situation, and with this change it is supported. Will need to continue to review the changelogs for 10.2/3 releases.

    Still need to change testing for the 2.0.x branch to not include D11 (hard error), or next minor (deprecation notice).

  • Status changed to Fixed 10 months ago
  • 🇦🇺Australia elc

    Merged in as it's been a couple of months.

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

Production build 0.71.5 2024