API page: https://api.drupal.org/api/drupal/core%21modules%21user%21src%21Entity%2...

> If the preferred language is not set or is a language not configured anymore on the site, the site default is returned or an empty string is returned (if $fallback_to_default is FALSE).

This is phased as "If A or B, then C or D, if E".

So, what happens if A? What happens if B? You can't really tell...

Logically, if there no no language configured on the site, then there's no site default to return, so you'd get an empty string. But it takes a fair amount of picking that sentence apart to see that.

This should be rewritten in several sentences, and ideally with bullet points to explain what happens.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

msankhala’s picture

Status: Active » Needs review
FileSize
1.12 KB

This patch fixes the doc with @return.

surbz’s picture

@msankhala Thanks for putting this up.
I can confirm that the patch applies cleanly and gives a better understanding.

surbz’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

crediting @joachim for filing this issue.

Committed and pushed bc8ba878e5 to 8.7.x and 9f4ca29c06 to 8.6.x. Thanks!

  • alexpott committed bc8ba87 on 8.7.x
    Issue #2972300 by msankhala, joachim: badly worded @return for...

  • alexpott committed 9f4ca29 on 8.6.x
    Issue #2972300 by msankhala, joachim: badly worded @return for...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.