Topic on Manual talk:Coding conventions

Enforce quote styles in PHP

3
Tacsipacsi (talkcontribs)
Arlolra (talkcontribs)
Krinkle (talkcontribs)

I don't think this should be enforced in code review, PHPCS, or otherwise in CI. We have a general guideline to follow, but I don't see it helping us to require code to change back and forth between two formats on a regular basis just due to the addition or removal of a character. Local consistently and productivity are I think more important factors.

When all else is equal, e.g. writing new code, or most strings in a method or file are equally simple, then our convention says to default to single quotes. Beyond that I don't think it's worth worrying about. In my opinion, string quoting isn't the sort of thing where cognitive overhead is induced by having variants or where it adds friction during review/auditing/debugging. You are goint to encounter both variants no matter what.

In my view, the guideline mainly exists as a tie-breaker when there's uncertaintity so that nobody has to discuss which one to use if they're not sure. But when modifying existing code, or once code has been put up for review, it's imho not worth changing or discussing further.

Reply to "Enforce quote styles in PHP"