mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +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:
parent
27cfd8d19e
commit
1eee75496a
1 changed files with 10 additions and 1 deletions
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue