Add void return to @ingroup entity_crud hook implementations

Created on 21 November 2024, 3 months ago

Problem/Motivation

See 📌 [META] Add return types to hook implementations Active

Almost all entity_crud hooks return void, except hook_entity_preload

Steps to reproduce

Proposed resolution

Script coming soon, putting up MR for now

Remaining tasks

User interface changes

Introduced terminology

API changes

Fixed workspaces hooks to not return from void methods

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

entity system

Created by

🇦🇺Australia mstrelan

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

Merge Requests

Comments & Activities

  • Issue created by @mstrelan
  • Pipeline finished with Failed
    3 months ago
    Total: 175s
    #345386
  • 🇦🇺Australia mstrelan
  • Pipeline finished with Success
    3 months ago
    Total: 1014s
    #345395
  • 🇦🇺Australia mstrelan

    Missed a few that don't have the right docs, i.e. "Implements hook_ENTITY_TYPE_":

    • Drupal\block_content_test\Hook\BlockContentTestHooks::blockContentInsert()
    • Drupal\block_content_test\Hook\BlockContentTestHooks::blockContentPresave()
    • Drupal\block_content_test\Hook\BlockContentTestHooks::blockContentUpdate()
    • Drupal\block_content_test\Hook\BlockContentTestHooks::blockContentView()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestDelete()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestInsert()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestLoad()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestPredelete()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestPresave()
    • Drupal\config_test\Hook\ConfigTestHooksHooks::configTestUpdate()
  • 🇦🇺Australia mstrelan

    I think hook_entity_bundle_create is meant to be in the entity_crud group too, but the doc has @see instead of @ingroup, which we should fix too. That would give us the following extras:

    • Drupal\field_ui\Hook\FieldUiHooks::entityBundleCreate()
    • Drupal\jsonapi\Hook\JsonapiHooks::entityBundleCreate()
    • Drupal\entity_schema_test\Hook\EntitySchemaTestHooks::entityBundleCreate()

    And some more for the list in #4:

    • \Drupal\field_ui\Hook\FieldUiHooks::entityViewModePresave
    • \Drupal\field_ui\Hook\FieldUiHooks::entityFormModePresave
    • \Drupal\field_ui\Hook\FieldUiHooks::entityViewModeDelete
    • \Drupal\field_ui\Hook\FieldUiHooks::entityFormModeDelete
  • 🇺🇸United States nicxvan

    I'll finish reviewing later this is a lot.

    In the meantime can you add any with incorrect implements comments here https://www.drupal.org/project/drupal/issues/3488948 📌 Confirm conversions where implements was incorrect Active

    Across all of these hook issues? We need to confirm the hook still has the extra type.

  • 🇺🇸United States nicxvan

    Ok I took a look through and I don't see any other exceptions either.

  • 🇦🇺Australia mstrelan

    A few more:

    \Drupal\image_module_test\Hook\ImageModuleTestHooks::imageStylePresave
    \Drupal\layout_builder\Hook\LayoutBuilderHooks::fieldConfigDelete
    \Drupal\layout_builder\Hook\LayoutBuilderHooks::fieldConfigInsert
    \Drupal\menu_link_content\Hook\MenuLinkContentHooks::menuDelete
    
  • 🇺🇸United States nicxvan

    \Drupal\layout_builder\Hook\LayoutBuilderHooks::fieldConfigDelete
    \Drupal\layout_builder\Hook\LayoutBuilderHooks::fieldConfigInsert

    Can be combined:
    Delete one Move the hook to the other along with the implements line to the other. Rename the method as well so it's not referencing one hook or the other!

    I also confirmed these ones, I'll move them to 📌 Confirm conversions where implements was incorrect Active for completeness.

  • 🇦🇺Australia mstrelan

    Re #9: there are plenty of hooks that could be refactored one way or another, but that's not really in scope here, so I'd prefer to leave that out.

  • 🇦🇺Australia mstrelan

    Rebased and updated those in #4, #5 and #8.

  • Pipeline finished with Success
    about 2 months ago
    Total: 1201s
    #386969
  • Pipeline finished with Success
    about 2 months ago
    Total: 452s
    #388120
  • Pipeline finished with Success
    about 2 months ago
    Total: 616s
    #389145
  • 🇺🇸United States smustgrave

    Needs a rebase

    If you are another contributor eager to jump in, please allow the previous poster at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • Pipeline finished with Success
    about 1 month ago
    Total: 682s
    #401334
  • Status changed to Needs review about 1 month ago
  • 🇺🇸United States smustgrave

    Rebase seems valid.

  • The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. 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.

  • 🇦🇺Australia mstrelan

    I think this also needs to update layout_builder_test_node_view, and the doc block should reference hook_ENTITY_TYPE_view not hook_entity_node_view.

  • First commit to issue fork.
  • Pipeline finished with Success
    25 days ago
    Total: 597s
    #408267
  • 🇮🇳India shalini_jha

    Re base this MR and fixed the conflict . Also address the feedback mentioned #16. Regenerate Baseline. Pipeline is green so moving this back to NR. please review

  • 🇺🇸United States smustgrave

    I think this is fine. I'd be a little hesitant to want to expand scope much more. Know pretty simple changes but still a large number of files.

  • Pipeline finished with Success
    17 days ago
    Total: 415s
    #415612
  • 🇮🇳India shalini_jha

    Re base this MR and fixed the conflict .

  • 🇳🇿New Zealand quietone

    Needs another rebase.

  • 🇳🇿New Zealand quietone

    Reviewing this is a bit more difficult because of the number of lines changed and the out of scope changes to the doc blocks. Changing the doc blocks in not mentioned in the Issue Summary, so that came as a surprise. Unlike a recent related issue where the out of scope changes were to comments, which I pushed back, these are just to the summary line. On one hand these are out of scope and on the other it makes sense to do it while 'we are here'. I lean to the latter.

    I've used the script locally and confirmed it works as intended. I then reviewed each commit here and I found no problems.

  • 🇦🇺Australia mstrelan

    Re-based and re-baselined

  • Pipeline finished with Failed
    12 days ago
    Total: 593s
    #419622
  • 🇺🇸United States smustgrave

    Rebased again but all green.

  • 🇳🇿New Zealand quietone

    Committed c7ebe84 and pushed to 11.x. Thanks!

  • 🇺🇸United States nicxvan
Production build 0.71.5 2024