Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22416271
ArcanistInstanceOfOperatorXHPASTLinterRule.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
856 B
Referenced Files
None
Subscribers
None
ArcanistInstanceOfOperatorXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistInstanceOfOperatorXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
69
;
public
function
getLintName
()
{
return
pht
(
'`%s` Operator'
,
'instanceof'
);
}
public
function
process
(
XHPASTNode
$root
)
{
$expressions
=
$root
->
selectDescendantsOfType
(
'n_BINARY_EXPRESSION'
);
foreach
(
$expressions
as
$expression
)
{
$operator
=
$expression
->
getChildOfType
(
1
,
'n_OPERATOR'
);
if
(
strtolower
(
$operator
->
getConcreteString
())
!=
'instanceof'
)
{
continue
;
}
$object
=
$expression
->
getChildByIndex
(
0
);
if
(
$object
->
isStaticScalar
()
||
$object
->
getTypeName
()
==
'n_SYMBOL_NAME'
)
{
$this
->
raiseLintAtNode
(
$object
,
pht
(
'`%s` expects an object instance, constant given.'
,
'instanceof'
));
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 01:31 (1 d, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1209191
Default Alt Text
ArcanistInstanceOfOperatorXHPASTLinterRule.php (856 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline