Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We should add a sniff to check for double quote usage when the string doesn't contain a variable. The coding standards recommend using single quotes unless double quotes are absolutely necessary.
Comments
Comment #1
klausiFrom https://drupal.org/coding-standards#quotes
So not sure if Coder should throw a warning or not.
Comment #2
psynaptic CreditAttribution: psynaptic commentedI guess I have misinterpreted the recommendation as a requirement:
For a long time, I've been fully in the mind that double quotes should be avoided unless single quotes are necessary but I'm rethinking that now and I think the use of double quotes everywhere makes a lot more sense. It feels wrong to switch from single to double just for the cases where they are needed. Consistency is important in code and it would work consistently to just use double quotes everywhere.
I don't buy the performance argument but someone mentioned to me just a moment ago that they think double quotes slightly are harder to read.
I'm going to close this and change my personal style to use double quotes but allow people to use whatever they want in code reviews.