Provide a simpler analyzer script for killing __init__.php
Summary:
The `phutil_analyzer.php` script currently analyzes entire modules and is fairly complex. We don't need or want this in a post-__init__.php world.
This is basically a simplified version of `phutil_analyzer.php`, which takes one file and emits symbols.
Test Plan:
```$ ./scripts/phutil_symbols.php resources/test/diverse_symbols.php
{
"have" : {
"function" : {
"f" : 348
},
"class" : {
"L" : 308,
"A" : 497,
"C" : 509,
"D" : 531,
"CLocal" : 627
},
"interface" : {
"ILocal" : 593
}
},
"need" : {
"function" : {
"g" : 402,
"h" : 462
},
"class" : {
"B" : 519,
"INonlocal" : 642,
"U" : 552,
"X" : 421,
"V" : 557,
"W" : 565,
"P" : 572
},
"interface" : {
"IForeign" : 608
}
}
}```
Reviewers: vrana, nh, btrahan
Reviewed By: vrana
CC: aran
Maniphest Tasks: T1103
Differential Revision: https://secure.phabricator.com/D2561
2012-05-24 19:56:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file has diverse symbol declarations and requirements, and can be used
|
|
|
|
// to test changes to phutil_symbols.php.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @phutil-external-symbol function ext_func
|
|
|
|
* @phutil-external-symbol class ExtClass
|
|
|
|
* @phutil-external-symbol interface ExtInterface
|
|
|
|
*/
|
|
|
|
ext_func();
|
|
|
|
new ExtClass();
|
|
|
|
class L implements ExtInterface { }
|
|
|
|
|
|
|
|
function f() { }
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
// Anonymous function.
|
|
|
|
});
|
|
|
|
|
|
|
|
g();
|
|
|
|
$g();
|
|
|
|
$$g();
|
|
|
|
|
|
|
|
X::f();
|
|
|
|
call_user_func();
|
|
|
|
call_user_func('h');
|
|
|
|
call_user_func($var);
|
|
|
|
|
|
|
|
class A { }
|
|
|
|
class C extends B { }
|
|
|
|
class D extends C { }
|
|
|
|
|
|
|
|
new U();
|
|
|
|
V::m();
|
|
|
|
W::$n;
|
|
|
|
P::CONST;
|
|
|
|
|
|
|
|
interface ILocal extends IForeign { }
|
|
|
|
class CLocal extends INonlocal { }
|
|
|
|
|
|
|
|
strtoupper('');
|
|
|
|
|
|
|
|
|
|
|
|
// Various magic things.
|
|
|
|
|
|
|
|
die($x);
|
|
|
|
empty($x);
|
|
|
|
isset($x);
|
|
|
|
echo($x);
|
|
|
|
print($x);
|
|
|
|
exit($x);
|
|
|
|
include($x);
|
|
|
|
include_once($x);
|
|
|
|
require($x);
|
2014-02-25 16:53:06 +01:00
|
|
|
require_once($x);
|