Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 5be656aa57166fbe4416802c9403023bfd9aeff5 1 parent 414e1e3
@epriestley epriestley authored
View
2  scripts/lib/PhutilLibraryMapBuilder.php
@@ -37,7 +37,7 @@
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
1  scripts/php_extension_classes.txt
@@ -0,0 +1 @@
+DOMDocument
View
37 scripts/phutil_symbols.php
@@ -410,23 +410,26 @@ class declarations are "have" symbols, while object instantiations
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'];
-
- // 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);
+ $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 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),
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.