Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php
Show All 39 Lines | /* -( Overriding Symbol Name Lint Messages )------------------------------- */ | ||||
* if (preg_match('/quack/i', $name)) { | * if (preg_match('/quack/i', $name)) { | ||||
* return 'Symbol names containing "quack" are forbidden.'; | * return 'Symbol names containing "quack" are forbidden.'; | ||||
* } | * } | ||||
* if ($type == 'method' && preg_match('/duck/i', $name)) { | * if ($type == 'method' && preg_match('/duck/i', $name)) { | ||||
* return null; // Always accept. | * return null; // Always accept. | ||||
* } | * } | ||||
* return $default; | * return $default; | ||||
* | * | ||||
* @param string The symbol type. | * @param string The symbol type. | ||||
* @param string The symbol name. | * @param string The symbol name. | ||||
* @param string|null The default result from the main rule engine. | * @param string|null The default result from the main rule engine. | ||||
* @return string|null Null to accept the name, or a message to reject it | * @param dict<string, string> Context | ||||
* with. You should return the default value if you don't | * @return string|null Null to accept the name, or a message to | ||||
* want to specifically provide an override. | * reject it with. You should return the | ||||
* default value if you don't want to | |||||
* specifically provide an override. | |||||
* @task override | * @task override | ||||
*/ | */ | ||||
abstract public function lintSymbolName($type, $name, $default); | abstract public function lintSymbolName( | ||||
$type, | |||||
$name, | |||||
$default, | |||||
array $context); | |||||
/* -( Name Utilities )----------------------------------------------------- */ | /* -( Name Utilities )----------------------------------------------------- */ | ||||
/** | /** | ||||
* Returns true if a symbol name is UpperCamelCase. | * Returns true if a symbol name is UpperCamelCase. | ||||
* | * | ||||
* @param string Symbol name. | * @param string Symbol name. | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |