~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to arcanist/src/lint/linter/xhpast/rules/ArcanistPHPShortTagXHPASTLinterRule.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-06-13 10:52:10 UTC
  • mfrom: (0.30.1) (0.29.1) (0.17.4) (2.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20150613105210-5uirr7tvnk0n6e6y
Tags: 0~git20150613-1
* New snapshot release (closes: #787805)
* fixed typo in logrotate script (closes: #787645)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
final class ArcanistPHPShortTagXHPASTLinterRule
 
4
  extends ArcanistXHPASTLinterRule {
 
5
 
 
6
  const ID = 6;
 
7
 
 
8
  public function getLintName() {
 
9
    return pht('Use of Short Tag "%s"', '<?');
 
10
  }
 
11
 
 
12
  public function process(XHPASTNode $root) {
 
13
    $tokens = $root->getTokens();
 
14
 
 
15
    foreach ($tokens as $token) {
 
16
      if ($token->getTypeName() === 'T_OPEN_TAG') {
 
17
        if (trim($token->getValue()) === '<?') {
 
18
          $this->raiseLintAtToken(
 
19
            $token,
 
20
            pht(
 
21
              'Use the full form of the PHP open tag, "%s".',
 
22
              '<?php'),
 
23
            "<?php\n");
 
24
        }
 
25
        break;
 
26
      }
 
27
    }
 
28
  }
 
29
 
 
30
}