Page MenuHomePhabricator

Diviner stops reading return type after <whitespace>
Closed, ResolvedPublic

Description

Not sure if this is an actual issue, I just noticed it when going through some of the docs.

At https://secure.phabricator.com/book/phabdev/class/PhabricatorCommonPasswords/#method/loadWordlist you will notice the return type is map<string, with the rest of the declared return type as the description, I haven't looked at how this is generated, but im assuming that it explodes/splits on whitespace.

Not sure if this needs to be resolved or anything, just thought I would mention it.

Original source: https://secure.phabricator.com/diffusion/P/browse/master/src/applications/auth/constants/PhabricatorCommonPasswords.php;c0e15f2c6587d68bdc894d365fe0a8ddc04bde6f$37 where you can see the stated return type is map<string, bool>

Event Timeline

Mnkras raised the priority of this task from to Needs Triage.
Mnkras updated the task description. (Show Details)
Mnkras added a project: Diviner.
Mnkras added a subscriber: Mnkras.

I'm not sure this is an actual bug either, but I won't let that stop me!

Here's the source DocBlock in question:

/**
 * Load the common password wordlist.
 *
 * @return map<string, bool>  Map of common passwords.
 *
 * @task common
 */

So should Diviner support this kind of notation? map<type, type> is useful shorthand, but should it be enshrined?

Maybe the DocBlock should look like this instead:

/**
 * Load the common password wordlist.
 *
 * @return array  An array of common passwords where the key is the password 
 *                and the value is true.  This map arrangement is convenient 
 *                when checking for common passowrds with code like 
 *                isSet($commonPasswords[$myPassword]). 
 *
 * @task common
 */

Or someone could just remove the space.