Page MenuHomePhabricator

D14625.diff
No OneTemporary

D14625.diff

diff --git a/src/lint/linter/xhpast/rules/ArcanistFunctionCallShouldBeTypeCastXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistFunctionCallShouldBeTypeCastXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistFunctionCallShouldBeTypeCastXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistFunctionCallShouldBeTypeCastXHPASTLinterRule.php
@@ -14,21 +14,25 @@
}
public function process(XHPASTNode $root) {
- static $cast_functions = array(
- 'boolval' => 'bool',
- 'doubleval' => 'double',
- 'floatval' => 'double',
- 'intval' => 'int',
- 'strval' => 'string',
- );
+ static $cast_functions;
+
+ if ($cast_functions === null) {
+ $cast_functions = new CaseInsensitiveArray(array(
+ 'boolval' => 'bool',
+ 'doubleval' => 'double',
+ 'floatval' => 'double',
+ 'intval' => 'int',
+ 'strval' => 'string',
+ ));
+ }
- $casts = $this->getFunctionCalls($root, array_keys($cast_functions));
+ $casts = $this->getFunctionCalls($root, $cast_functions->getKeys());
foreach ($casts as $cast) {
$function_name = $cast
->getChildOfType(0, 'n_SYMBOL_NAME')
->getConcreteString();
- $cast_name = $cast_functions[strtolower($function_name)];
+ $cast_name = $cast_functions[$function_name];
$parameters = $cast->getChildOfType(1, 'n_CALL_PARAMETER_LIST');
$replacement = null;

File Metadata

Mime Type
text/plain
Expires
Tue, May 21, 11:25 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6291777
Default Alt Text
D14625.diff (1 KB)

Event Timeline