| Defined | src/lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php:14 |
|---|---|
| Group | Lint Integration |
You can extend this class and set "lint.xhpast.naminghook" in your .arcconfig to have an opportunity to override lint results for symbol names.
| return | this |
The constructor is final because ArcanistXHPASTLinter is responsible for hook instantiation.
| parameters | string | $symbol | Symbol name. |
| return | bool | True if the symbol is lowerCamelCase. |
Returns true if a symbol name is lowerCamelCase.
| parameters | string | $symbol | Symbol name. |
| return | bool | True if the symbol is lowercase_with_underscores. |
Returns true if a symbol name is lowercase_with_underscores.
| parameters | string | $symbol | Symbol name. |
| return | bool | True if the symbol is UpperCamelCase. |
Returns true if a symbol name is UpperCamelCase.
| parameters | string | $symbol | Symbol name. |
| return | bool | True if the symbol is UPPERCASE_WITH_UNDERSCORES. |
Returns true if a symbol name is UPPERCASE_WITH_UNDERSCORES.
| parameters | string | $type | The symbol type. |
| string | $name | The symbol name. | |
| string|null | $default | The default result from the main rule engine. | |
| return | string|null | Null to accept the name, or a message to reject it with. You should return the default value if you don't want to specifically provide an override. |
Callback invoked for each symbol, which can override the default determination of name validity or accept it by returning $default. The symbol types are: xhp-class, class, interface, function, method, parameter, constant, and member.
For example, if you want to ban all symbols with "quack" in them and otherwise accept all the defaults, except allow any naming convention for methods with "duck" in them, you might implement the method like this:
if (preg_match('/quack/i', $name)) { return 'Symbol names containing "quack" are forbidden.'; } if ($type == 'method' && preg_match('/duck/i', $name)) { return null; // Always accept. } return $default;
| parameters | string | $symbol | Symbol name. |
| return | string | Stripped symbol. |
Strip non-name components from PHP function symbols. Notably, this discards the "__" magic-method signifier, to make a symbol appropriate for testing with methods like isLowerCamelCase().
| parameters | string | $symbol | Symbol name. |
| return | string | Stripped symbol. |
Strip non-name components from PHP variable symbols. Notably, this discards the "$", to make a symbol appropriate for testing with methods like isLowercaseWithUnderscores().