Problem/Motivation

Several implementations of getInstance() don't return the value described in the following documentation comment.

   * @return object|false
   *   A fully configured plugin instance. The interface of the plugin instance
   *   will depend on the plugin type. If no instance can be retrieved, FALSE
   *   will be returned.

FormatterPluginManager and WidgetPluginManager return NULL instead of FALSE.

Proposed resolution

Change the code to return FALSE as documented.

CommentFileSizeAuthor
#6 3275585-6.patch3.03 KBdspachos
#4 3275585-4.patch3.69 KBdspachos

Comments

joachim created an issue. See original summary.

avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Title: implementations of getInstance() return wrong type » Implementations of getInstance() return the wrong type
dspachos’s picture

StatusFileSize
new3.69 KB

here is a quick patch

dspachos’s picture

dspachos’s picture

StatusFileSize
new3.03 KB
avpaderno’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Reviewed & tested by the community

LGTM!

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

  • catch committed 953611f on 10.0.x
    Issue #3275585 by dspachos, apaderno, joachim: Implementations of...
  • catch committed d9b8a31 on 10.1.x
    Issue #3275585 by dspachos, apaderno, joachim: Implementations of...
  • catch committed ab63e97 on 9.5.x
    Issue #3275585 by dspachos, apaderno, joachim: Implementations of...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

Status: Fixed » Closed (fixed)

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