silverstripeltd / bespoke-standards

Silverstripe PHPCS standards for Bespoke squads
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Feat: Disallow snake naming convention in favor of camel case #7

Open satrun77 opened 10 months ago

satrun77 commented 10 months ago

Disallow

function some_cool_thing() {}

$cool_value = '';

class big_cool_thig {}

protected $cool_var = '';

Allow

private static $cool_var = ''; <-- only silverstripe static config property
public static function get_extensions($class = null, $includeArgumentString = false) <-- methods from the core depenencies

function someCoolThing() {}

$coolValue = '';

class BigCoolThig {} <-- must uppercase first letter

protected $coolVar = '';

The sniff exists however we need custom one that uses the core sniff and bypass silverstripe core method and extend the sniff to cover properties.

https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Docs/NamingConventions/CamelCapsFunctionNameStandard.xml

edwilde commented 10 months ago

Yep, i'd be in favour of that 👍