Problem/Motivation

Enums and Traits should use UpperCamel naming, this is currently not checked in Coder

The checking is done by the Drupal.NamingConventions.ValidClassName sniff.

Steps to reproduce

Write bad enum or trait names.

Proposed resolution

  • Expand checking of ValidClassNameSniff to traits and enums.

Test examples:


class CorrectClassName {}
class CorrectClassWithAReallyLongName {}
class INCORRECT_CLASS_NAME {}
class INCORRECTCLASSNAME {}
class incorrectLowercaseClassName {}

interface CorrectInterfaceName {}
interface CorrectInterfaceWithAReallyLongName {}
interface INCORRECT_INTERFACE_NAME {}
interface INCORRECTINTERFACENAME {}
interface incorrectLowercaseInterfaceName {}

trait CorrectTraitName {}
trait CorrectTraitWithAReallyLongName {}
trait INCORRECT_TRAIT_NAME {}
trait INCORRECTTRAITNAME {}
trait incorrectLowercaseTraitName {}

enum CorrectEnumName {}
enum CorrectEnumWithAReallyLongName {}
enum INCORRECT_ENUM_NAME {}
enum INCORRECTENUMNAME {}
enum incorrectLowercaseEnumName {}

Remaining tasks

pull request

API changes

None

Comments

klausi created an issue. See original summary.

  • klausi authored 04a4563b on 8.3.x
    feat(ValidClassName): Check traits and enums for valid upperCamel names...
klausi’s picture

  • klausi authored ba30df56 on 8.3.x
    fix(ValidClassName): Allow upper case with number (#3497580)
    
    
klausi’s picture

Coder 8.3.28 was released with this fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.