#camelCaseVariables lint rule in php

4 messages · Page 1 of 1 (latest)

calm nimbus
#

How can I enforce devs to name variables in camelCase in php?
pint.json:

{
  "preset": "laravel",
  "rules": {
    "camel_case_variables": true
  }
}

Does not work because there is not such rule camel_case_variables.

What is your solution for this in a large project with many developrs?

#

camel_case_variables lint rule in php

#

camelCaseVariables lint rule in php

sand lantern
#

Pint (or rather PHP-CS-Fixer) doesn't have a rule for that.
This is partially because it's a rather difficult rule to implement properly (all usages must also match, even within blade for example). But also, PER/PSR-12 etc don't have a recommendation / rule for it either. So it would have to be something that's enforced in your own guidelines, or you'd need to write your own fixer