1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Update Diviner for array-valued @doc-stuff return values from DocblockParser

Summary: Ref T11575. After D16431, the parser may return arrays.

Test Plan: Ran `bin/diviner generate --clean` in `phabricator/` without errors. Previously, this raised some parsing errors related to getting arrays where strings were expected.

Reviewers: chad, yelirekim, joshuaspence

Reviewed By: joshuaspence

Maniphest Tasks: T11575

Differential Revision: https://secure.phabricator.com/D16487
This commit is contained in:
epriestley 2016-09-02 04:51:40 -07:00
parent 27cfd8d19e
commit 1eee75496a

View file

@ -141,7 +141,7 @@ final class DivinerPHPAtomizer extends DivinerAtomizer {
$docs = idx($metadata, 'param');
if ($docs) {
$docs = explode("\n", $docs);
$docs = (array)$docs;
$docs = array_filter($docs);
} else {
$docs = array();
@ -283,6 +283,15 @@ final class DivinerPHPAtomizer extends DivinerAtomizer {
}
}
$return = (array)$return;
if (count($return) > 1) {
$atom->addWarning(
pht(
'Documentation specifies `%s` multiple times.',
'@return'));
}
$return = head($return);
if ($atom->getName() == '__construct' && $atom->getType() == 'method') {
$return_spec = array(
'doctype' => 'this',