Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15198749
D14625.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14625.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 24, 4:53 AM (14 h, 13 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7188822
Default Alt Text
D14625.diff (1 KB)
Attached To
Mode
D14625: Use `CaseInsensitiveArray` in `ArcanistFunctionCallShouldBeTypeCastXHPASTLinterRule`
Attached
Detach File
Event Timeline
Log In to Comment