Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php
| <?php | <?php | ||||
| /** | /** | ||||
| * You can extend this class and set `xhpast.naminghook` in your `.arclint` to | * You can extend this class and set `xhpast.naminghook` in your `.arclint` to | ||||
| * have an opportunity to override lint results for symbol names. | * have an opportunity to override lint results for symbol names. | ||||
| * | * | ||||
| * @task override Overriding Symbol Name Lint Messages | * @task override Overriding Symbol Name Lint Messages | ||||
| * @task util Name Utilities | * @task util Name Utilities | ||||
| * @task internal Internals | * @task internal Internals | ||||
| * @group lint | |||||
| * @stable | * @stable | ||||
| */ | */ | ||||
| abstract class ArcanistXHPASTLintNamingHook { | abstract class ArcanistXHPASTLintNamingHook { | ||||
| /* -( Internals )---------------------------------------------------------- */ | /* -( Internals )---------------------------------------------------------- */ | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | /* -( Name Utilities )----------------------------------------------------- */ | ||||
| * the "__" magic-method signifier, to make a symbol appropriate for testing | * the "__" magic-method signifier, to make a symbol appropriate for testing | ||||
| * with methods like @{method:isLowerCamelCase}. | * with methods like @{method:isLowerCamelCase}. | ||||
| * | * | ||||
| * @param string Symbol name. | * @param string Symbol name. | ||||
| * @return string Stripped symbol. | * @return string Stripped symbol. | ||||
| * @task util | * @task util | ||||
| */ | */ | ||||
| public static function stripPHPFunction($symbol) { | public static function stripPHPFunction($symbol) { | ||||
| // Allow initial "__" for magic methods like __construct; we could also | // Allow initial "__" for magic methods like __construct; we could also | ||||
| // enumerate these explicitly. | // enumerate these explicitly. | ||||
| return preg_replace('/^__/', '', $symbol); | return preg_replace('/^__/', '', $symbol); | ||||
| } | } | ||||
| /** | /** | ||||
| * Strip non-name components from PHP variable symbols. Notably, this discards | * Strip non-name components from PHP variable symbols. Notably, this discards | ||||
| * the "$", to make a symbol appropriate for testing with methods like | * the "$", to make a symbol appropriate for testing with methods like | ||||
| * @{method:isLowercaseWithUnderscores}. | * @{method:isLowercaseWithUnderscores}. | ||||
| * | * | ||||
| Show All 9 Lines | |||||