Some IsbnToolsService methods do not respect the expected return typehints

Created on 30 August 2024, 3 months ago

Problem/Motivation

After upgrading to Drupal 10.3.2 and using PHP 8.2, we are getting the following error:

TypeError  Drupal\isbn\IsbnToolsService::convertIsbn10to13(): Return value must be of type ?string, none returned.

This is because the method returns void instead of NULL when the ISBN passed is not valid.

Same behavior can be shown in other methods like convertIsbn13to10() or format().

Steps to reproduce

Run this code: \Drupal::service('isbn.isbn_service')->convertIsbn10to13('foo');

Observe the Type Error

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇪🇸Spain plopesc Valladolid

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

Comments & Activities

Production build 0.71.5 2024