From ede6947dd1efef8f5a3f17487f137a6dfa62eb94 Mon Sep 17 00:00:00 2001 From: Eric Stern Date: Tue, 1 Jul 2014 06:16:44 -0700 Subject: [PATCH] Don't atomize closures Summary: In a PHP5.3+ codebase with closures, Diviner would pick up anonymous functions and add them into the generated documentation. This causes them to be skipped. Test Plan: Ran `bin/diviner generate --clean` before and after change, no longer got a bunch of unnamed functions dumped into the documentation. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9786 --- src/applications/diviner/atomizer/DivinerPHPAtomizer.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php index 18405b9116..c6288aefbc 100644 --- a/src/applications/diviner/atomizer/DivinerPHPAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerPHPAtomizer.php @@ -22,6 +22,11 @@ final class DivinerPHPAtomizer extends DivinerAtomizer { $name = $func->getChildByIndex(2); + // Don't atomize closures + if ($name->getTypeName() === 'n_EMPTY') { + continue; + } + $atom = $this->newAtom(DivinerAtom::TYPE_FUNCTION) ->setName($name->getConcreteString()) ->setLine($func->getLineNumber()) -- 2.54.0