Problem/Motivation

To meet coding standards this needs to be a full doc block or the 'Used ..' line removed.

  /**
   * {@inheritdoc}
   * Used in \Drupal\field\Tests\EntityReference\EntityReferenceAdminTest::testAvailableFormatters().
   */
  public static function isApplicable(FieldDefinitionInterface $field_definition) {
    // Returns FALSE if machine name of the field equals field_onewidgetfield.
    return $field_definition->getName() != "field_onewidgetfield";
  }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

quietone created an issue. See original summary.

quietone’s picture

There is only one testAvailableFormatters which is in ./core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php. I ran that test with a breakpoint in isApplicable() and the breakpoint was never reached. Is this method used at all?

quietone’s picture

Issue tags: +Coding standards
longwave’s picture

Status: Active » Needs review
StatusFileSize
new1010 bytes

There's one way to find out.

field_onewidgetfield is referred to in two tests, core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php and core/modules/field/tests/src/Kernel/WidgetPluginManagerTest.php.

If this patch passes, then I guess the code is safe to remove.

If the patch fails, I think we just drop the "Used in..." and leave @inheritdoc.

longwave’s picture

StatusFileSize
new1.23 KB

Fix unused use statement.

Status: Needs review » Needs work

The last submitted patch, 5: 3269000-5.patch, failed testing. View results

shashwat purav’s picture

Status: Needs work » Needs review
StatusFileSize
new1.18 KB

Added patch to fix docblock of TestFieldWidgetMultiple::isApplicable.

Status: Needs review » Needs work

The last submitted patch, 7: 3269000-6.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new1.16 KB
new1.29 KB

The new doc comment isn't adding anything, it is the same as the comment in the function. So, I looked at the WidgetPluginManager to get a better idea of what this is doing and then made a new comment. I also added an @see because of a comment Berdir made in the original issue that added this method, #2204325-20: The "rendered entity" formatter breaks for entity types with out a ViewBuilder.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Version: 10.0.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 09672b4d3f to 10.1.x and a8a8904503 to 10.0.x and 70cd4ec217 to 9.5.x. Thanks!

Backported to 9.5.x as this is a docs only fix.

  • alexpott committed 09672b4 on 10.1.x
    Issue #3269000 by longwave, quietone, Shashwat Purav: fix docblock of...

  • alexpott committed a8a8904 on 10.0.x
    Issue #3269000 by longwave, quietone, Shashwat Purav: fix docblock of...

  • alexpott committed 70cd4ec on 9.5.x
    Issue #3269000 by longwave, quietone, Shashwat Purav: fix docblock of...

Status: Fixed » Closed (fixed)

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