Phan – A static analyzer for PHP
github.com
github.com
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.
#!/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...