@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Jump to PHP docs from symbol search more often

Summary:
It's kind of nice to type `s explode` in jump nav and have it
just work. This involves weakening a bunch of the request parameter
checks, but the only real extra assumption is that language defaults to
PHP... which is not that big of a stretch, and it's not like we know
about any other languages' documentation.

It'd be better to have builtins be more first-class and less awkward
hack, but that seems hard.

Test Plan: Search for symbols.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3302

+14 -16
+14 -16
src/applications/diffusion/controller/DiffusionSymbolController.php
··· 68 68 69 69 // For PHP builtins, jump to php.net documentation. 70 70 if ($request->getBool('jump') && count($symbols) == 0) { 71 - if ($request->getStr('lang') == 'php') { 72 - switch ($request->getStr('type')) { 73 - case 'function': 74 - $functions = get_defined_functions(); 75 - if (in_array($this->name, $functions['internal'])) { 71 + if ($request->getStr('lang', 'php') == 'php') { 72 + if ($request->getStr('type', 'function') == 'function') { 73 + $functions = get_defined_functions(); 74 + if (in_array($this->name, $functions['internal'])) { 75 + return id(new AphrontRedirectResponse()) 76 + ->setURI('http://www.php.net/function.'.$this->name); 77 + } 78 + } 79 + if ($request->getStr('type', 'class') == 'class') { 80 + if (class_exists($this->name, false) || 81 + interface_exists($this->name, false)) { 82 + if (id(new ReflectionClass($this->name))->isInternal()) { 76 83 return id(new AphrontRedirectResponse()) 77 - ->setURI('http://www.php.net/function.'.$this->name); 84 + ->setURI('http://www.php.net/class.'.$this->name); 78 85 } 79 - break; 80 - case 'class': 81 - if (class_exists($this->name, false) || 82 - interface_exists($this->name, false)) { 83 - if (id(new ReflectionClass($this->name))->isInternal()) { 84 - return id(new AphrontRedirectResponse()) 85 - ->setURI('http://www.php.net/class.'.$this->name); 86 - } 87 - } 88 - break; 86 + } 89 87 } 90 88 } 91 89 }