Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282807
ArcanistInnerFunctionXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
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
Mar 24 2025, 11:12 (7 w, 11 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120355
Default Alt Text
ArcanistInnerFunctionXHPASTLinterRule.php (903 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment