ValidVariableNameSniff generates an error Class property %s should use lowerCamel naming without underscores

Classes that define Annotations have class variables which map 1-to-1 with annotation key names, so this sniff incidentally requires that all annotation keys be lowerCamel.

However, there is NO place in Drupal core that uses lowerCamel for annotation keys - EVERY annotation key in core is either a single lower case word or multiple lower case words separated by underscores. Likewise, all documentation for Plugins shows snake case for annotation keys, not lowerCamel.

Additionally, if you try to 'fix' the code that this sniff complains about, that breaks every plugin using that annotation.

The sniff currently exempts config entity properties from the lowerCamel check - the same should be done for annotation classes.

Comments

TR created an issue. See original summary.

JeroenT’s picture

Status: Active » Closed (duplicate)

I guess this issue can be closed since this is fixed in the latest version: #2804739: Underscore separation is allowed for plugin annotation class properties