getUserId returns string instead of int or bool

Created on 8 January 2024, over 1 year ago
Updated 9 May 2024, about 1 year ago

Problem/Motivation

I'm not sure what's causing this to happen, but I'm getting the following error in my logs:

TypeError: Drupal\set_author\Plugin\EntityShareClient\Processor\SetAuthor::getUserId(): Return value must be of type int|bool, string returned in Drupal\set_author\Plugin\EntityShareClient\Processor\SetAuthor->getUserId() (line 213 of /app/web/modules/contrib/set_author/src/Plugin/EntityShareClient/Processor/SetAuthor.php)

Steps to reproduce

Unclear.

Proposed resolution

Since Drupal generally treats integer strings as integers when dealing with IDs, I propose adding an (int) type hint on the return statement to satisfy the function's own constraint.

Remaining tasks

make a fork

πŸ› Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States BenStallings

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