Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22416008
ArcanistThisReassignmentXHPASTLinterRule.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
957 B
Referenced Files
None
Subscribers
None
ArcanistThisReassignmentXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistThisReassignmentXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
91
;
public
function
getLintName
()
{
return
pht
(
'`%s` Reassignment'
,
'$this'
);
}
public
function
process
(
XHPASTNode
$root
)
{
$binary_expressions
=
$root
->
selectDescendantsOfType
(
'n_BINARY_EXPRESSION'
);
foreach
(
$binary_expressions
as
$binary_expression
)
{
$operator
=
$binary_expression
->
getChildOfType
(
1
,
'n_OPERATOR'
);
if
(
$operator
->
getConcreteString
()
!=
'='
)
{
continue
;
}
$variable
=
$binary_expression
->
getChildByIndex
(
0
);
if
(
$variable
->
getTypeName
()
!=
'n_VARIABLE'
)
{
continue
;
}
if
(
$variable
->
getConcreteString
()
==
'$this'
)
{
$this
->
raiseLintAtNode
(
$binary_expression
,
pht
(
'`%s` cannot be re-assigned. '
.
'This construct will cause a PHP fatal error.'
,
'$this'
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 01:30 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1221779
Default Alt Text
ArcanistThisReassignmentXHPASTLinterRule.php (957 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline