Problem/Motivation

phpstan-drupal 2.4.0 reports both plugin managers as annotation-only (pluginManager.attributeDiscoveryMissing), so the phpstan job fails on 1.1.x, 1.2.x and 2.0.x. Annotation-only discovery is deprecated in Drupal 11.2 and removed in Drupal 12.

Steps to reproduce

  1. Run the phpstan CI job on any branch, for example the 1.2.4 tag pipeline.
  2. See the errors in src/Style/StyleManager.php line 31 and src/StylesGroup/StylesGroupManager.php line 52.

Proposed resolution

  • 2.0.x: add Style and StylesGroup attribute classes, used by the managers on Drupal 10.2 and newer. Older cores keep annotation-only discovery.
  • 1.2.x: the same attribute classes, the managers pass the attribute and the annotation, and the module's own plugins move to attributes. The annotation classes stay for plugins in other modules.
  • 1.1.x (Drupal older than 10.3): add the two errors to the phpstan baseline, since the deprecation never applies there.

The attribute classes build on podarok's MR !88 in #3629649: Drupal 12 compatibility: add ^12 to core_version_requirement and fix removed/changed APIs, with group_id and icon added so plugins can use them. The ^12 change stays in #3629649: Drupal 12 compatibility: add ^12 to core_version_requirement and fix removed/changed APIs.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support
  • ➖ User Guide Documentation support
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ✅ Update Release Notes
  • ✅ Release

User interface changes

  • N/A

API changes

  • New plugin attributes Drupal\bootstrap_styles\Attribute\Style and Drupal\bootstrap_styles\Attribute\StylesGroup. Annotation-based plugins keep working.

Data model changes

  • N/A

Release notes snippet

  • The Style and Styles group plugin managers support PHP attribute discovery.
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

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
Status: Active » Needs review

  • rajab natshah committed 23d25859 on 2.0.x
    task: #3637458 Add PHP attribute discovery to the Style and StylesGroup...

  • rajab natshah committed e45171be on 1.2.x
    task: #3637458 Add PHP attribute discovery to the Style and StylesGroup...

  • rajab natshah committed 4eae08f4 on 1.1.x
    task: #3637458 Add the plugin manager attribute discovery errors to the...
rajab natshah’s picture

Issue summary: View changes
Status: Needs review » Fixed
Issue tags: +bootstrap_styles-1.2.5, +bootstrap_styles-1.1.11

✅ Released in bootstrap_styles-1.2.5
✅ Released in bootstrap_styles-1.1.11

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.