Page MenuHomeSealhub

ArcanistPHPOpenTagXHPASTLinterRule.php
No OneTemporary

Authored By
Unknown
Size
805 B
Referenced Files
None
Subscribers
None

ArcanistPHPOpenTagXHPASTLinterRule.php

<?php
final class ArcanistPHPOpenTagXHPASTLinterRule
extends ArcanistXHPASTLinterRule {
const ID = 15;
public function getLintName() {
return pht('Expected Open Tag');
}
public function process(XHPASTNode $root) {
$tokens = $root->getTokens();
foreach ($tokens as $token) {
if ($token->getTypeName() === 'T_OPEN_TAG') {
break;
} else if ($token->getTypeName() === 'T_OPEN_TAG_WITH_ECHO') {
break;
} else {
if (!preg_match('/^#!/', $token->getValue())) {
$this->raiseLintAtToken(
$token,
pht(
'PHP files should start with `%s`, which may be preceded by '.
'a `%s` line for scripts.',
'<?php',
'#!'));
}
break;
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 28, 02:22 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1208631
Default Alt Text
ArcanistPHPOpenTagXHPASTLinterRule.php (805 B)

Event Timeline