PickGoForm::pickGo(): Missing return if $l10n_groups is empty

Created on 24 October 2025, 2 months ago

Problem/Motivation

phpstan complains about one problem that it cannot add to the baseline.

Unignorable errors could not be added to the baseline:
Method Drupal\l10n_community\Form\PickGoForm::pickGo() should return array but return statement is missing.
/var/www/html/web/modules/custom/l10n_server/l10n_community/src/Form/PickGoForm.php

This is a valid observation, the method is dead if it reaches that condition.

  private function pickGo(): array {
    [..]
    if (!empty($l10n_groups)) {
      return [...];
    }
  }

Steps to reproduce

Simply run phpstan, it will produce an inspection warning like above.

But for the actual behavior, the following must occur:
The current user has (at least) one group membership.
None of these group memberships is for a group with group type 'translation'.

Proposed resolution

The reasonable thing is to return []. We already do that if a user has no group memberships.

We should add a test for this. But currently there is no test at all for this case, and I am not even sure what the form does.
Maybe we can do this trivial fix and a `@todo` to add a test.

Remaining tasks

Follow-up to write test for this form.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany donquixote

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.

  • Status changed to Fixed 1 day ago
Production build 0.71.5 2024