The source code looks great, and I could see this supplanting some of the other tools out there for PHP static analysis.
https://groups.google.com/forum/#!search/allspaw$20phriend%7...
For now, we have a primordial Syntastic vim plugin (https://github.com/etsy/phan/blob/master/plugins/vim/bundle/...) for getting errors into the quickfix view.
If you want to start working on that, feel free to open up an issue (https://github.com/etsy/phan/issues/new) to start a conversation about it.
We currently store method/function callers in the sqlite database (see https://github.com/etsy/phan/blob/master/src/Phan/Analyze/Br...), but aren't yet exposing an interface for getting callers. We'll want to store callers for constants, classes, properties and global variables as well.
Project started after mine. https://github.com/cweagans/theforce
Just ran out of time, so mkusher did his own thing. I disagree with his direction and I think it's overly complex from a user's standpoint, but he disagrees and isn't willing to change it, so I lost interest in that project too.
Using the actual AST from the PHP interpreter is going to be a) much faster and b) much more accurate.
That being said, you should take a look at the '-s' flag for saving state to a sqlite database. After the initial run the stored state can be used to only scan changed files. For a patch with a few files changed it should be about 0.5s to run the analysis.
I'm not sure what SIMD refers to. Can you clarify that?
I do this for things like:
$user_requirements = [filter1, filter2];
foreach ($user_requirements as $test) { if (!$test($some_data)) { return false; } return true; }
Is there any way to tell the analyzer to make sure that afunction of n arguments is passed in?
With a name like "asm" that comes as a surprise... Single Instruction Multiple Data[0] refers to low level processor instructions that are able to work across a range of data, e.g. video cards working on changing the values in a framebuffer with one instruction mapping across an entire buffer in parallel.
That being said, I'm really glad that this helps millions of PHP devs around the world so bravo to the people working on this.
PHP was the "right tool" in that it was the language Zuck knew when it was a one-man project. And facebook's success is a reminder that second-tier technologies can be perfectly adequate to build a successful business on, that business concerns often have a lot more impact than technical ones. It shouldn't be taken as an indication that all their technical decisions were right.
Popular has little to do with fair, and a lot to do with being in the right place at the right time.
And network effects mean that being popular can make something desirable for some uses even when its intrinsic features aren't superior. And, anyway, while Ruby may sometimes lose to PHP for this reasons, it (due to Rails) often benefits from this, too.
Every language with a non-trivial number of users tends to have a couple (or maybe couple dozen) different static analyzers of varying quality. This is one of the PHP static analyzers.
Yes, except those static analyzers are the compilers for those languages and the rules that define crappy programs are in the type system, not in ad-hoc specifications of patterns to identify for static analyzers...
While some compilers do ship with static analysis components (e.g. Clang), static analyzers are usually distinct from compilers. Doesn't matter it for static or dynamic languages.
The first linting tool was made in 1979 for C programs and I remember ads for PC-Lint in the back of programming magazines all the time growing up. Static analysis tools catch more than just datatype errors. They look for patterns that identity common logic errors as well. PC-Lint used to cost a couple hundred dollars, and people were plenty willing to pay that much for extra peace of mind.
This is also why Facebook has spent so much time and effort on things like HHVM and Hack.
* Would you hire somebody who wasn't able to learn a new language in a reasonable amount of time?
* Would you let somebody who just started with PHP (by virtue of it being an easy language to start with) work on your backend?
FWIW, they have released cool open source projects on Haskell and ocaml, so it's not like they've never considered any alternatives.
In many cases the latter forces you to compromises in what you pick and the first one in compromises when you pick it.
I fully understand when people try to make work what they have.
Eg PHP by itself is a very fast powerful language. The tooling and several aspects (dynamic type etc) are exhausting for larger code bases but this is something which people inhouse can solve without requesting the full company to switch.
Static analysis has nothing to do with typing. Static analysis is about interpreted code, where you lack the luxury of compiler warnings.
Heroku, DO, and AWS all fully support PHP, which they wouldn't bother doing if there weren't a market.