1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +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 LIBRARY_MAP_VERSION = 2;
const SYMBOL_CACHE_VERSION_KEY = '__symbol_cache_version__'; const SYMBOL_CACHE_VERSION_KEY = '__symbol_cache_version__';
const SYMBOL_CACHE_VERSION = 5; const SYMBOL_CACHE_VERSION = 6;
/* -( Mapping libphutil Libraries )---------------------------------------- */ /* -( Mapping libphutil Libraries )---------------------------------------- */

View file

@ -0,0 +1 @@
DOMDocument

View file

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