Problem/Motivation

Inside of metatag.post_update.php there is a function metatag_post_update_convert_author_data there is an unused else at this point:

if ($sandbox['total_records'] > 0) {
    return (string) t('Processed @processed of @total overridden Metatag records.', [
      '@processed' => $sandbox['records_processed'],
      '@total' => $sandbox['total_records'],
    ]);
  }
  else {
    return (string) t("There were no overridden Metatag records.");
  }

And there is a best practice recommendation to avoid using else if isn't necessary. https://freek.dev/2212-avoid-using-else

Proposed resolution

We can just remove this unnecessary else

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork metatag-3336301

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

RenatoG created an issue. See original summary.

renatog’s picture

Status: Active » Needs review
damienmckenna’s picture

Version: 2.0.x-dev » 8.x-1.x-dev
Status: Needs review » Reviewed & tested by the community
Parent issue: » #3313052: Plan for Metatag 8.x-1.23

A reasonable little improvement, thank you.

damienmckenna’s picture

Title: Unnecessary else in the "metatag_post_update_convert_author_data" » Unnecessary else in metatag_post_update_convert_author_data()
Status: Reviewed & tested by the community » Fixed

Committed. Thank you.

Status: Fixed » Closed (fixed)

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