From 58fbf64a27861cd45f56712c0deeefd24f680a5e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 6 Apr 2020 11:47:55 -0700 Subject: [PATCH] Refine handling of "@task" attributes in Diviner Summary: Ref T13505. See that task for details. When a class has exactly one "@task" block, this API returns a string. Some day, this should be made more consistent. Test Plan: Viewed a class with exactly one "@task", no more fatal. Viewed classes with zero and more than one "@task" attributes, got clean renderings. Maniphest Tasks: T13505 Differential Revision: https://secure.phabricator.com/D21062 --- .../diviner/controller/DivinerAtomController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/applications/diviner/controller/DivinerAtomController.php b/src/applications/diviner/controller/DivinerAtomController.php index 3363f55c8e..60eba689e4 100644 --- a/src/applications/diviner/controller/DivinerAtomController.php +++ b/src/applications/diviner/controller/DivinerAtomController.php @@ -435,6 +435,15 @@ final class DivinerAtomController extends DivinerController { $task_specs = array(); $tasks = $symbol->getAtom()->getDocblockMetaValue('task'); + + if (!is_array($tasks)) { + if (strlen($tasks)) { + $tasks = array($tasks); + } else { + $tasks = array(); + } + } + if ($tasks) { foreach ($tasks as $task) { list($name, $title) = explode(' ', $task, 2);