Problem/Motivation

Param definition in function comment is missing a type. This is important because many code editors use the functional documentation to describe parameters when you're using the function.

Proposed resolution

Add type to the param

Remaining tasks

Submit a patch

User interface changes

None

API changes

None - just improved documentation

Data model changes

None - just improved documentation

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

koppie created an issue. See original summary.

koppie’s picture

Assigned: koppie » Unassigned
Status: Active » Needs review
FileSize
530 bytes

I've rolled a patch that adds the type to the param. Please review. :-)

YesCT’s picture

Status: Needs review » Reviewed & tested by the community

yeah, I think string is the correct type.

thanks!

YesCT’s picture

Issue tags: +rc eligible

  • xjm committed bb7142f on 8.0.x
    Issue #2600004 by koppie, YesCT: Missing param type for getOption()
    
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @koppie for the patch!

I reviewed this to confirm that the $name parameter is only ever a string. It's used as an array key in getOption(), which means it needs to be a string or integer, and all the calls to getOption() in core pass a string literal. Also, the documented usage for the parameter (on t()) says this:

 * @param $options
 *   An associative array of additional options, with the following elements:
 *   - 'langcode' (defaults to the current language): The language code to
 *     translate to a language other than what is used to display the page.
 *   - 'context' (defaults to the empty context): The context the source string
 *     belongs to.

So based on that, this is the correct parameter type documentation.

As a docs-only change, this is RC eligible. Committed and pushed to 8.0.x. Thanks!

xjm’s picture

(Fixing issue credit. crossposts-- Thanks @YesCT).

Status: Fixed » Closed (fixed)

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