Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Phan – A static analyzer for PHP (github.com/rlerdorf)
15 points by ingve on July 22, 2015 | hide | past | favorite | 6 comments


how does it work with frameworks? f.e. Symfony? there are usually lots of unused framework's code in almost any project


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.


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...


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


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?





Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: