Page MenuHomePhorge

ArcanistAbstractMethodBodyXHPASTLinterRule.php
No OneTemporary

ArcanistAbstractMethodBodyXHPASTLinterRule.php

<?php
final class ArcanistAbstractMethodBodyXHPASTLinterRule
extends ArcanistXHPASTLinterRule {
const ID = 108;
public function getLintName() {
return pht('`%s` Method Cannot Contain Body', 'abstract');
}
public function process(XHPASTNode $root) {
$methods = $root->selectDescendantsOfType('n_METHOD_DECLARATION');
foreach ($methods as $method) {
$modifiers = $this->getModifiers($method);
$body = $method->getChildByIndex(6);
if (idx($modifiers, 'abstract') && $body->getTypeName() != 'n_EMPTY') {
$this->raiseLintAtNode(
$body,
pht(
'`%s` methods cannot contain a body. This construct will '.
'cause a fatal error.',
'abstract'));
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Dec 19, 17:00 (22 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1014832
Default Alt Text
ArcanistAbstractMethodBodyXHPASTLinterRule.php (765 B)

Event Timeline