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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top