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

Between the comments in the code for UserData::get(), there are some similar to the following one.

// If $module and $uid was passed, return the name/value pairs.

It should use were, since A and B is considered plural, in English.

// If $module and $uid were passed, return the name/value pairs.

I would also use the similar wording using for the last comment.

// If $module and $uid were passed, return data keyed by name.

Similarly, I would do for the following comments.

// If $module, $uid, and $name was passed, return the value.
// If $module and $name was passed, return the uid/value pairs.

The first comment needs just the verb to be corrected.

CommentFileSizeAuthor
#3 was-versus-were-2886365-3.patch1.26 KBavpaderno

Comments

kiamlaluno created an issue. See original summary.

avpaderno’s picture

Issue summary: View changes

I hope I choose the correct component for the issue. Since it's about comments in the code, I considered them inlined documentation for the code.

avpaderno’s picture

Status: Active » Needs review
StatusFileSize
new1.26 KB
dinesh18’s picture

Status: Needs review » Reviewed & tested by the community

Yes you are correct. Patch looks good to me.
Changing the status to RTBC.

xjm’s picture

Title: Comments for the UserData::get() code wrongly use "was" instead of "were" » Comments for the UserData::get() code are unclear and wrongly use "was" instead of "were"

Updating the issue title to reflect the full scope including rewriting the comments.

  • xjm committed ee0b6ab on 8.4.x
    Issue #2886365 by kiamlaluno: Comments for the  UserData::get() code are...

  • xjm committed 1ab5a48 on 8.3.x
    Issue #2886365 by kiamlaluno: Comments for the  UserData::get() code are...
xjm’s picture

Version: 8.4.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Fixed

Since automated checking can't catch grammatical errors, I agree that it's fine to just fix these three comments as in the patch.

I read over the code in UserData::get() as well as the method documentation for UserDataInterface::get(), and confirmed that the updated comments accurately describe what is happening. (Also, um, yeesh. The mixed return value for this method is, um, scary. We should refactor that, but that's out of scope here.)

Committed to 8.4.x, and cherry-picked to 8.3.x since as a documentation improvement it is eligible for backport. Thanks!

xjm’s picture

Status: Fixed » Closed (fixed)

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