Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistPHPCloseTagXHPASTLinterRule.php
<?php | <?php | ||||
final class ArcanistPHPCloseTagXHPASTLinterRule | final class ArcanistPHPCloseTagXHPASTLinterRule | ||||
extends ArcanistXHPASTLinterRule { | extends ArcanistXHPASTLinterRule { | ||||
const ID = 8; | const ID = 8; | ||||
public function getLintName() { | public function getLintName() { | ||||
return pht('Use of Close Tag `%s`', '?>'); | return pht('Use of Close Tag `%s`', '?>'); | ||||
} | } | ||||
public function process(XHPASTNode $root) { | public function process(XHPASTNode $root) { | ||||
$inline_html = $root->selectDescendantsOfType('n_INLINE_HTML'); | $inline_html = $root->selectDescendantsOfType('n_INLINE_HTML'); | ||||
if ($inline_html) { | if (count($inline_html) > 0) { | ||||
return; | return; | ||||
} | } | ||||
foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) { | foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) { | ||||
$this->raiseLintAtToken( | $this->raiseLintAtToken( | ||||
$token, | $token, | ||||
pht( | pht( | ||||
'Do not use the PHP closing tag, `%s`.', | 'Do not use the PHP closing tag, `%s`.', | ||||
'?>')); | '?>')); | ||||
} | } | ||||
} | } | ||||
} | } |