Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22421795
ArcanistInnerFunctionXHPASTLinterRule.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
903 B
Referenced Files
None
Subscribers
None
ArcanistInnerFunctionXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistInnerFunctionXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
59
;
public
function
getLintName
()
{
return
pht
(
'Inner Functions'
);
}
public
function
getLintSeverity
()
{
return
ArcanistLintSeverity
::
SEVERITY_WARNING
;
}
public
function
process
(
XHPASTNode
$root
)
{
$function_decls
=
$root
->
selectDescendantsOfType
(
'n_FUNCTION_DECLARATION'
);
foreach
(
$function_decls
as
$function_declaration
)
{
$inner_functions
=
$function_declaration
->
selectDescendantsOfType
(
'n_FUNCTION_DECLARATION'
);
foreach
(
$inner_functions
as
$inner_function
)
{
if
(
$inner_function
->
getChildByIndex
(
2
)->
getTypeName
()
==
'n_EMPTY'
)
{
// Anonymous closure.
continue
;
}
$this
->
raiseLintAtNode
(
$inner_function
,
pht
(
'Avoid the use of inner functions.'
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 03:14 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1209188
Default Alt Text
ArcanistInnerFunctionXHPASTLinterRule.php (903 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline