LazyPluginCollection::initializePlugin() doesn't document it can throw exceptions

Created on 16 July 2025, about 1 month ago

Problem/Motivation

Various implementations of this throw exceptions. E.g.

DefaultLazyPluginCollection (although see 🐛 DefaultLazyPluginCollection::initializePlugin() throws the wrong sort of exception Active ):

      throw new PluginNotFoundException($instance_id);

BlockPluginCollection:

      throw new PluginException("The block '{$this->blockId}' did not specify a plugin.");

Steps to reproduce

Proposed resolution

Add a @throws tag to the docs.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

documentation

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @joachim
  • First commit to issue fork.
  • Merge request !12755Issue #3536252: Added @throws statement. → (Open) created by nexusnovaz
  • 🇬🇧United Kingdom nexusnovaz

    I've added the statement and opened the MR 12755. However, i know this is dependent on 🐛 DefaultLazyPluginCollection::initializePlugin() throws the wrong sort of exception Active , however, im hoping that we can merge that in without any issues once upstream. I won't mark as needs review just yet, but will keep an eye on that parent ticket.

  • Pipeline finished with Success
    30 days ago
    Total: 777s
    #549575
  • 🇬🇧United Kingdom joachim

    The new docs need to go on LazyPluginCollection, not the child class.

    And I think there are several cases where an exception is thrown, and child classes may add more, so we should probably be vague and just say 'if the plugin cannot be instantiated'.

    And yes, you're right to wait for the other issue to get in.

  • 🇬🇧United Kingdom nexusnovaz

    I've made a change in the location of the comment and the comment itself. But once again, i know this needs to wait to be merged in! Will leave as Active for now.

  • Pipeline finished with Failed
    3 days ago
    #571104
Production build 0.71.5 2024