Page MenuHomeSealhub

ArcanistInstanceOfOperatorXHPASTLinterRule.php
No OneTemporary

Authored By
Unknown
Size
852 B
Referenced Files
None
Subscribers
None

ArcanistInstanceOfOperatorXHPASTLinterRule.php

<?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

Mime Type
text/x-php
Expires
Fri, Nov 27, 15:19 (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1219155
Default Alt Text
ArcanistInstanceOfOperatorXHPASTLinterRule.php (852 B)

Event Timeline