Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22418258
ArcanistBlacklistedFunctionXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistBlacklistedFunctionXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistBlacklistedFunctionXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
51
;
private
$blacklistedFunctions
=
array
();
public
function
getLintName
()
{
return
pht
(
'Use of Blacklisted Function'
);
}
public
function
getLinterConfigurationOptions
()
{
return
parent
::
getLinterConfigurationOptions
()
+
array
(
'xhpast.blacklisted.function'
=>
array
(
'type'
=>
'optional map<string, string>'
,
'help'
=>
pht
(
'Blacklisted functions which should not be used.'
),
),
);
}
public
function
setLinterConfigurationValue
(
$key
,
$value
)
{
switch
(
$key
)
{
case
'xhpast.blacklisted.function'
:
$this
->
blacklistedFunctions
=
$value
;
return
;
default
:
return
parent
::
getLinterConfigurationOptions
();
}
}
public
function
process
(
XHPASTNode
$root
)
{
$calls
=
$root
->
selectDescendantsOfType
(
'n_FUNCTION_CALL'
);
foreach
(
$calls
as
$call
)
{
$node
=
$call
->
getChildByIndex
(
0
);
$name
=
$node
->
getConcreteString
();
$reason
=
idx
(
$this
->
blacklistedFunctions
,
$name
);
if
(
$reason
)
{
$this
->
raiseLintAtNode
(
$node
,
$reason
);
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 02:11 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1219605
Default Alt Text
ArcanistBlacklistedFunctionXHPASTLinterRule.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline