1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01:00

Jump to PHP Manual for PHP's internal classes and interfaces in symbol search

Test Plan: Clicked on `Exception` in `throw new Exception`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1978
This commit is contained in:
vrana 2012-03-21 12:18:05 -07:00
parent 12973fca36
commit ccc258fa85

View file

@ -65,11 +65,23 @@ 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') {
if ($request->getStr('type') == 'function') {
if (in_array($this->name, idx(get_defined_functions(), 'internal'))) {
switch ($request->getStr('type')) {
case '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 (class_exists($this->name) ||
in_array($this->name, get_declared_interfaces())) {
if (id(new ReflectionClass($this->name))->isInternal()) {
return id(new AphrontRedirectResponse())
->setURI('http://www.php.net/class.'.$this->name);
}
}
break;
}
}
}