Fix missing return case in sitemap_book_title_update()

Created on 3 August 2024, 8 months ago
Updated 27 August 2024, 7 months ago

Problem/Motivation

The sitemap_book_title_update() helper function in sitemap.install has a missing return case (i.e.: when show_title is TRUE but the book cannot be loaded). This causes a PHPStan lint that looks like: Function sitemap_book_title_update() should return string but return statement is missing..

Proposed resolution

Return an empty string if the book cannot be loaded.

Basically, we can do this by inverting the outer if statement, so the book is only loaded if show_title is TRUE-ish, and the book label is returned if the book is valid; and in all other cases, it falls through to returning the empty string.

Remaining tasks

  1. - skipped, written by module maintainer
  2. - skipped, written by module maintainer

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada mparker17 UTC-4

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024