Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890560
ArcanistLambdaFuncFunctionXHPASTLinterRule.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
1 KB
Referenced Files
None
Subscribers
None
ArcanistLambdaFuncFunctionXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistLambdaFuncFunctionXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
68
;
public
function
getLintName
(
)
{
return
pht
(
'`%s` Function'
,
'__lambda_func'
)
;
}
public
function
process
(
XHPASTNode
$root
)
{
$function_declarations
=
$root
->
selectDescendantsOfType
(
'n_FUNCTION_DECLARATION'
)
;
foreach
(
$function_declarations
as
$function_declaration
)
{
$function_name
=
$function_declaration
->
getChildByIndex
(
2
)
;
if
(
$function_name
->
getTypeName
(
)
==
'n_EMPTY'
)
{
// Anonymous closure.
continue
;
}
if
(
$function_name
->
getConcreteString
(
)
!=
'__lambda_func'
)
{
continue
;
}
$this
->
raiseLintAtNode
(
$function_declaration
,
pht
(
'Declaring a function named `%s` causes any call to %s to fail. '
.
'This is because `%s` eval-declares the function `%s`, then '
.
'modifies the symbol table so that the function is instead '
.
'named `%s`, and returns that name.'
,
'__lambda_func'
,
'create_function'
,
'create_function'
,
'__lambda_func'
,
'"\0lambda_".(++$i)'
)
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 13:45 (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120546
Default Alt Text
ArcanistLambdaFuncFunctionXHPASTLinterRule.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment