Recently I wanted to make automatic checking of PHP code before deployment to the server (not Unit tests). That is, hotels to have a tool that would say that the code might be an error. Unfortunately, I only know php -f (performance script) and the php -l (check for syntax errors). Perhaps, there are some 3rd party tools for analysis. Googling permission problems are not given, unfortunately (mostly offered plug-ins for well-known IDE, but I would like Tulsa, zapuskaem from the command line).
apt-cache search php | grep analy
also says nothing good :)
If you know such tools please share with us.