Fivestar Element drupal-check issues.

Created on 22 July 2021, over 3 years ago
Updated 3 October 2023, about 1 year ago

Problem/Motivation

Drupal-check found some issues with Element\Fivestar which on manual inspection warranted further work.

1. In the getElementDescription() function the switch finishes with return for all cases, but the default case is not included, which resulted in a 'doesn't return array in all cases' error from the check. The fault was possible should the settings be bad, which is perfectly possible.
including a default case beside the 'none' case is sufficient.

2. userCanVote() sets entity_type and entity_id in a way for which the ?? operator was designed and is clearer.

Moved to #3226149: userCanVote(), getElementDescription(), process() need cleanup β†’ :

Proposed resolution

The attached patch adds in the type hints and todo, and updates the expressions with ??. This is really meant as a starting point for discussion, though the type hints are useful in themselves.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom rivimey

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024