Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php
Context not available. | |||||
* otherwise accept all the defaults, except allow any naming convention for | * otherwise accept all the defaults, except allow any naming convention for | ||||
* methods with "duck" in them, you might implement the method like this: | * methods with "duck" in them, you might implement the method like this: | ||||
* | * | ||||
* 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; | ||||
Context not available. | |||||
* @task util | * @task util | ||||
*/ | */ | ||||
public static function isUpperCamelCase($symbol) { | public static function isUpperCamelCase($symbol) { | ||||
return preg_match('/^[A-Z][A-Za-z0-9]*$/', $symbol); | return @preg_match('/^[A-Z][A-Za-z0-9]*$/', $symbol); | ||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
* @task util | * @task util | ||||
*/ | */ | ||||
public static function isLowerCamelCase($symbol) { | public static function isLowerCamelCase($symbol) { | ||||
return preg_match('/^[a-z][A-Za-z0-9]*$/', $symbol); | return @preg_match('/^[a-z][A-Za-z0-9]*$/', $symbol); | ||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
* @task util | * @task util | ||||
*/ | */ | ||||
public static function isUppercaseWithUnderscores($symbol) { | public static function isUppercaseWithUnderscores($symbol) { | ||||
return preg_match('/^[A-Z0-9_]+$/', $symbol); | return @preg_match('/^[A-Z0-9_]+$/', $symbol); | ||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
* @task util | * @task util | ||||
*/ | */ | ||||
public static function isLowercaseWithUnderscores($symbol) { | public static function isLowercaseWithUnderscores($symbol) { | ||||
return preg_match('/^[a-z0-9_]+$/', $symbol); | return @preg_match('/^[a-z0-9_]+$/', $symbol); | ||||
} | } | ||||
/** | /** | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0