Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22393956
ArcanistLambdaFuncFunctionXHPASTLinterRule.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
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'
,
'"
\0
lambda_".(++$i)'
));
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 27, 16:12 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1209174
Default Alt Text
ArcanistLambdaFuncFunctionXHPASTLinterRule.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline