Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3281618
ArcanistInstanceOfOperatorXHPASTLinterRule.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
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
Sun, Mar 23, 23:58 (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1120888
Default Alt Text
ArcanistInstanceOfOperatorXHPASTLinterRule.php (856 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment