
Phan – A static analyzer for PHP - ingve
https://github.com/rlerdorf/phan
======
gondo
how does it work with frameworks? f.e. Symfony? there are usually lots of
unused framework's code in almost any project

~~~
rll
You can do partial scans. If you create a list of files and only feed it the
ones you care about it can scan those. It will complain about missing classes,
but you can ignore those with phan -i

Usually a middle ground works best. Run it once on just your files and look at
the undeclared classes then add the files from the framework that define those
so you get at least one level of checks of your calls into the framework. Or
just feed it everything, but it can take some time to scan thousands of files
and if you aren't using most of that code it gets annoying.

------
harryf
Pretty nice. Although I have a simpler implementation...

    
    
        #!/bin/sh
        if grep --quiet '<?php' $1; then
            echo 'run for your lives!'
        else
            echo 'phew. all ok'
        fi
    

Edit: OK so everyone lost their sense of humour. Was just pre-empting the
inevitable PHP bashing to come...

~~~
smrtinsert
In the time you wrote this comment, Facebook added another 1900 lines of php.
There's nothing funny about that.

~~~
ectoplasm
5 minutes per comment, 12 comments per hour, 8 hours per day = 96 comments per
day, call it 100. 100 * 1900 = 190000, call it 200K. You really think Facebook
is adding 200K lines of php per day?

