Question

I am using PHAN in my projects and wonder if there is some kind of codesniffer to validate the code is PHAN compliant.

Was it helpful?

Solution

My guess is that you could use Codesniffer (http://pear.php.net/manual/en/package.php.php-codesniffer.php), but you would have to create your own custom sniffs. It doesn't look too hard, and all the documentation is there.

What you can do is check that each variable name is made up of the legal prefixes.

What you might be able to do is check that private class variable begin with _.

What you won't be able to do is check that the correct type prefix is used. This is because PHP variables are dynamically typed and can change over the life of the variable. It would be impossible for a static code analyser to figure that our.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top