]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Include extension classes in the builtin list
authorepriestley <git@epriestley.com>
Thu, 26 Jul 2012 21:46:53 +0000 (14:46 -0700)
committerepriestley <git@epriestley.com>
Thu, 26 Jul 2012 21:46:53 +0000 (14:46 -0700)
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

scripts/lib/PhutilLibraryMapBuilder.php
scripts/php_extension_classes.txt [new file with mode: 0644]
scripts/phutil_symbols.php

index 84b95b86dfa10ac1decbf2f72e3441b79bcad7da..e58fde04d0ccf6fc4ea0792046abfd2ae1ca101d 100755 (executable)
@@ -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  )---------------------------------------- */
diff --git a/scripts/php_extension_classes.txt b/scripts/php_extension_classes.txt
new file mode 100644 (file)
index 0000000..5cdc95c
--- /dev/null
@@ -0,0 +1 @@
+DOMDocument
index 740ce680d92b3e42768d9391f1b2f05517714a98..9df312f4e37bc874e0e54a43b592302d1aae27ed 100755 (executable)
@@ -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'];
-
-  // 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),
   );
 }