From 8ccff6b1babbc2aee06ce3ecbfe83b7bcd9dfa8d Mon Sep 17 00:00:00 2001 From: mainframe98 Date: Thu, 12 Feb 2026 20:07:53 +0100 Subject: [PATCH] Diviner: Parse generic types in doc blocks better Summary: Type hints for parameters can be generic, such as `array`. Some of these contain spaces, like `array`, which was parsed incorrectly previously. This resulted in a line like ` * @param map $attributes (optional) A map of tag attributes.` rendering as `map $attributes (optional) A map of tag attributes.` instead of `map | $attributes | $attributes (optional) A map of tag attributes.`. Closes T16499 Test Plan: * Run `./bin/diviner generate` on git master * Look at the "Parameters" box on http://phorge.localhost/book/dev/function/phutil_tag/ * Apply this patch * Run `./bin/diviner generate --clean` * Look at the "Parameters" box on http://phorge.localhost/book/dev/function/phutil_tag/ Reviewers: O1 Blessed Committers, aklapper Reviewed By: O1 Blessed Committers, aklapper Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T16499 Differential Revision: https://we.phorge.it/D26752 --- src/applications/diviner/atomizer/DivinerPHPAtomizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php index 103a4a9d47..f3e07214ff 100644 --- a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php @@ -231,7 +231,7 @@ final class DivinerPHPAtomizer extends DivinerAtomizer { protected function parseParamDoc(DivinerAtom $atom, $doc, $name) { $dict = array(); - $split = preg_split('/\s+/', trim($doc), 2); + $split = preg_split('/(?