Problem/Motivation

Drupal core is deprecating Doctrine-style annotations such as @Block, @ContentEntityType, and @ConfigEntityType in favour of native PHP attributes. Annotation support will be removed in Drupal 13.

og_menu should migrate where its supported core range (^10.5 || ^11.1.2 || ^12.0) allows it.

Proposed resolution

Convert OgMenuBlock from @Block to #[Block], which is supported across the module's full core range.

Add #[ConfigEntityType] and #[ContentEntityType] to OgMenu and OgMenuInstance while retaining their existing annotations. Entity type attribute discovery was introduced in Drupal 11.2, so the annotations are still required for Drupal 10.5 through 11.1.x.

Drupal's dual discovery mechanism prefers attributes when supported and falls back to annotations on older cores. This matches the approach already used by OG and other contrib modules.

Remaining tasks

Remove the remaining entity annotations once og_menu drops support for Drupal core versions earlier than 11.2.

Verify PHPStan, PHPCS, and the full kernel/unit test suite continue to pass without new deprecation notices.

Issue fork og_menu-3623456

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

joelpittet created an issue. See original summary.

  • joelpittet committed 33c34ec9 on 2.x
    task: #3623456 Convert PHP annotations to PHP attributes
    
    By: joelpittet
    
joelpittet’s picture

Status: Needs review » Fixed

Merged into 2.x

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.