The instructions for Coder and the code sniffer module tell us that we should download coder into Drush's global command directory to make code sniffer and drush integration work for everyone. This is all fine and great. However, if you download coder and install it on a Drupal site on the same computer/server, and run anything with Drush, you get the following error:
PHP Fatal error: Cannot redeclare coder_review_drush_help() (previously declared in /usr/share/drush/commands/coder/coder_review/coder_review.drush.inc:63) in ...sites/all/modules/contrib/coder/coder_review/coder_review.drush.inc on line 39
This means that we cannot run Drush through the Drupal UI at all and means we can never install it as a module, which was unexpected.
Comments
Comment #1
slefevre1 CreditAttribution: slefevre1 commentedI'm getting this error also.
Comment #2
dcmouyard CreditAttribution: dcmouyard commentedConfirming that this is still a problem.
Comment #3
douggreen CreditAttribution: douggreen commentedThis is a problem, there isn't an easy solution, I hope to solve it with #2099351: Coder Drupal 8.x Battleplan.
Comment #4
dkh CreditAttribution: dkh commentedI'd love to see a fix for this too. I have coder in ~/drush but my University's main install profile also has it in the modules directory, which I have to remove everytime I do a local site install.
Comment #5
rooby CreditAttribution: rooby commentedMarked #2341263: PHP Fatal error: Cannot redeclare drupalcs_drush_command() as a duplicate of this.
Comment #6
esomething CreditAttribution: esomething commentedI deleted the files in ~/.drush/cache/default and the error went away.
Comment #7
klausiCoder 7.x is frozen now and will not receive updates. Coder 8.x-2.x can be used to check code for any Drupal version, Coder 8.x-2.x also supports the phpcbf command to automatically fix conding standard errors. Please check if this issue is still relevant and reopen against that version if necessary.