I've downloaded the Drupal coder package (7.x-2.0-beta2) from http://drupal.org/project/coder and extracted the relevant standard files; but when I try to execute from the CLI I'm getting:
Fatal error: Call to undefined method Drupal_Sniffs_InfoFiles_ClassFilesSniff::register() in /php/PEAR/PHP/CodeSniffer.php on line 1007
sure enough, looking at the file itself, there is no register() method defined in the ClassFilesSniff.php file.
Does anybody know what token types this sniff should be listening for, so that I can add the register() myself?
If I manually add a registre method, as
public function register()
{
return array(T_CLASS);
}//end register()
then the sniff registers, but I get
Catchable fatal error: Argument 1 passed to Drupal_Sniffs_InfoFiles_ClassFilesSn iff::process() must be of the type array, object given, called in /php/P EAR/PHP/CodeSniffer/File.php on line 492 and defined in /php/PEAR/PHP/Co deSniffer/Standards/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php on line 44
when it is processed
I'm using the latest PEAR codesniffer
Any clues?
I just succeed in removing that error.
Try set your pear config to a different state.
pear config-set preferred_state stable
And then remove CodeSniffer with
pear uninstall php_codesniffer
And reinstall with
pear install --alldeps php_codesniffer
My preferred_state was set to 'alpha', but when I changed it to 'stable' the phpcs stated working again.