I am using PHAN in my projects and wonder if there is some kind of codesniffer to validate the code is PHAN compliant.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.