1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 15:21:03 +01:00

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
This commit is contained in:
Alan Huang 2012-08-15 17:47:04 -07:00
parent 6623a721d3
commit 627584f501

View file

@ -68,16 +68,15 @@ final class DiffusionSymbolController extends DiffusionController {
// For PHP builtins, jump to php.net documentation.
if ($request->getBool('jump') && count($symbols) == 0) {
if ($request->getStr('lang') == 'php') {
switch ($request->getStr('type')) {
case 'function':
if ($request->getStr('lang', 'php') == 'php') {
if ($request->getStr('type', 'function') == 'function') {
$functions = get_defined_functions();
if (in_array($this->name, $functions['internal'])) {
return id(new AphrontRedirectResponse())
->setURI('http://www.php.net/function.'.$this->name);
}
break;
case 'class':
}
if ($request->getStr('type', 'class') == 'class') {
if (class_exists($this->name, false) ||
interface_exists($this->name, false)) {
if (id(new ReflectionClass($this->name))->isInternal()) {
@ -85,7 +84,6 @@ final class DiffusionSymbolController extends DiffusionController {
->setURI('http://www.php.net/class.'.$this->name);
}
}
break;
}
}
}