Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22400604
ArcanistPlusOperatorOnStringsXHPASTLinterRule.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
942 B
Referenced Files
None
Subscribers
None
ArcanistPlusOperatorOnStringsXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistPlusOperatorOnStringsXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
21
;
public
function
getLintName
()
{
return
pht
(
'Not String Concatenation'
);
}
public
function
process
(
XHPASTNode
$root
)
{
$binops
=
$root
->
selectDescendantsOfType
(
'n_BINARY_EXPRESSION'
);
foreach
(
$binops
as
$binop
)
{
$op
=
$binop
->
getChildByIndex
(
1
);
if
(
$op
->
getConcreteString
()
!==
'+'
)
{
continue
;
}
$left
=
$binop
->
getChildByIndex
(
0
);
$right
=
$binop
->
getChildByIndex
(
2
);
if
(
$left
->
getTypeName
()
===
'n_STRING_SCALAR'
||
$right
->
getTypeName
()
===
'n_STRING_SCALAR'
)
{
$this
->
raiseLintAtNode
(
$binop
,
pht
(
"In PHP, '%s' is the string concatenation operator, not '%s'. "
.
"This expression uses '+' with a string literal as an operand."
,
'.'
,
'+'
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 27, 18:10 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1222725
Default Alt Text
ArcanistPlusOperatorOnStringsXHPASTLinterRule.php (942 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline