-2

I want to respect coding standard in my new Drupal projects (for Drupal 8 and Drupal 9). Using phpcs and phpcbf, I am wondering if I should use PSR12, Drupal, or DrupalPractice coding standards. Do you have any advice?

1

Drupal / DrupalPractice are the Drupal coding standards, which is probably why your question got downvoted.

The Drupal coding standards are pretty well documented.

Drupalize.me also has a tutorial about how to set up your local dev environment.

There are also a variety of tools that automatically apply the coding standards such as the Drupal Code Quality Checker.

2
  • Yes i know that, i was just wondering myself why the don't adopt PSR12.
    – lchabrand
    Jan 14 at 14:50
  • @Ichabrand Given the size of the Drupal ecosystem, it would be an enormous amount of work to change standards. Maybe they will eventually, but Drupal is historically pretty slow to adopt other standards, and it tends to hold on to what it's got. (For example, jQuery is still in core even though it's no longer a hot technology and there are many other js libraries that are much "cooler".) Jan 14 at 14:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.