You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have a sniff which could check that an alias name provided in import use statements and trait use statements complies with certain naming conventions.
The most common naming convention for class names would probably be StudlyCaps/PascalCase.
Along the same lines, the most common naming convention for function names would probably be camelCase, while for constants it would be MACRO_CASE.
Supporting other naming conventions for each should also be considered.
Describe the solution you'd like
A new sniff with a choice of which naming convention to enforce for each type of alias.
Some examples:
// StudlyCaps/PascalCase class aliases.useVendor\Package\ClassNameasMyClass; // OK.useVendor\Package\ClassNameasmyClass; // Not OK.useVendor\Package\ClassNameasMy_Class; // Not OK.// camelCase function aliases.usefunctionVendor\Package\functionNameasmyFunction; // OK.usefunctionVendor\Package\functionNameasmy_function; // Not OK.class Aliased_Talker {
use A, B {
B::bigTalk as talk; // OK
B::smallTalk asTALKING; // Not OK.
}
}
// MACRO_CASE constant aliases,useconstVendor\Package\CONSTANT_NAMEasMY_CONSTANT; // OK.useconstVendor\Package\CONSTANT_NAMEasmyCONSTANT; // Not OK.
Additional context (optional)
Might be a good idea for the sniff to also check that aliases also complies with the following additional conventions:
No leading underscore(s).
No trailing underscore(s).
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
It would be nice to have a sniff which could check that an alias name provided in import
use
statements and traituse
statements complies with certain naming conventions.The most common naming convention for class names would probably be StudlyCaps/PascalCase.
Along the same lines, the most common naming convention for function names would probably be camelCase, while for constants it would be MACRO_CASE.
Supporting other naming conventions for each should also be considered.
Describe the solution you'd like
A new sniff with a choice of which naming convention to enforce for each type of alias.
Some examples:
Additional context (optional)
Might be a good idea for the sniff to also check that aliases also complies with the following additional conventions:
The text was updated successfully, but these errors were encountered: