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

Include extension classes in the builtin list

Summary: Just like we ship with a list of extension functions, add a list of extension classes so people stop getting lint errors about DOMDocument just because some linter uses it.

Test Plan: Ran "arc lint".

Reviewers: vrana, btrahan, codeblock

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3082
This commit is contained in:
epriestley 2012-07-26 14:46:53 -07:00
parent 414e1e3e40
commit 5be656aa57
3 changed files with 20 additions and 16 deletions

View file

@ -37,7 +37,7 @@ final class PhutilLibraryMapBuilder {
const LIBRARY_MAP_VERSION = 2;
const SYMBOL_CACHE_VERSION_KEY = '__symbol_cache_version__';
const SYMBOL_CACHE_VERSION = 5;
const SYMBOL_CACHE_VERSION = 6;
/* -( Mapping libphutil Libraries )---------------------------------------- */

View file

@ -0,0 +1 @@
DOMDocument

View file

@ -410,23 +410,26 @@ if ($args->getArg('ugly')) {
function phutil_symbols_get_builtins() {
$builtin_classes = get_declared_classes();
$builtin_interfaces = get_declared_interfaces();
$builtin_functions = get_defined_functions();
$builtin_functions = $builtin_functions['internal'];
$builtin = array();
$builtin['classes'] = get_declared_classes();
$builtin['interfaces'] = get_declared_interfaces();
$funcs = get_defined_functions();
$builtin['functions'] = $funcs['internal'];
foreach (array('functions', 'classes') as $type) {
// Developers may not have every extension that a library potentially uses
// installed. We supplement the list of declared functions with a list of
// known extension functions to avoid raising false positives just because
// you don't have pcntl, etc.
$list = dirname(__FILE__).'/php_extension_functions.txt';
$extension_functions = file_get_contents($list);
$extension_functions = explode("\n", trim($extension_functions));
$builtin_functions = array_merge($builtin_functions, $extension_functions);
// installed. We supplement the list of declared functions and classses with
// a list of known extension functions to avoid raising false positives just
// because you don't have pcntl, etc.
$list = dirname(__FILE__)."/php_extension_{$type}.txt";
$extensions = file_get_contents($list);
$extensions = explode("\n", trim($extensions));
$builtin[$type] = array_merge($builtin[$type], $extensions);
}
return array(
'class' => array_fill_keys($builtin_classes, true) + array(
'class' => array_fill_keys($builtin['classes'], true) + array(
'PhutilBootloader' => true,
),
'function' => array_filter(
@ -446,7 +449,7 @@ function phutil_symbols_get_builtins() {
// them as builtin since we need to add dependencies for them.
'idx' => false,
'id' => false,
) + array_fill_keys($builtin_functions, true)),
'interface' => array_fill_keys($builtin_interfaces, true),
) + array_fill_keys($builtin['functions'], true)),
'interface' => array_fill_keys($builtin['interfaces'], true),
);
}