Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistInlineHTMLXHPASTLinterRule.php
| Show All 16 Lines | public function process(XHPASTNode $root) { | ||||
| $inline_html = $root->selectTokensOfType('T_INLINE_HTML'); | $inline_html = $root->selectTokensOfType('T_INLINE_HTML'); | ||||
| foreach ($inline_html as $html) { | foreach ($inline_html as $html) { | ||||
| if (substr($html->getValue(), 0, 2) == '#!') { | if (substr($html->getValue(), 0, 2) == '#!') { | ||||
| // Ignore shebang lines. | // Ignore shebang lines. | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (preg_match('/^\s*$/', $html->getValue())) { | |||||
| continue; | |||||
| } | |||||
| $this->raiseLintAtToken( | $this->raiseLintAtToken( | ||||
| $html, | $html, | ||||
| pht('PHP files must only contain PHP code.')); | pht('PHP files must only contain PHP code.')); | ||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||