1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Allow closing tags in files containing HTML

Summary: Ref T8742. PHP files which contain inline HTML should be allowed to use PHP closing tags (`?>`). This is in accordance with [[https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md | PSR-2 guidelines]].

Test Plan: Updated unit tests.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T8742

Differential Revision: https://secure.phabricator.com/D13794
This commit is contained in:
Joshua Spence 2015-08-06 06:56:26 +10:00
parent fb5d5b86fa
commit 402899a9c3
3 changed files with 6 additions and 2 deletions

View file

@ -2,4 +2,3 @@
This shouldn't fatal the parser. This shouldn't fatal the parser.
~~~~~~~~~~ ~~~~~~~~~~
error:1:10

View file

@ -4,7 +4,6 @@ garbage garbage
?> ?>
~~~~~~~~~~ ~~~~~~~~~~
error:1:1 error:1:1
error:4:1
~~~~~~~~~~ ~~~~~~~~~~
garbage garbage garbage garbage
<?php <?php

View file

@ -10,6 +10,12 @@ final class ArcanistPHPCloseTagXHPASTLinterRule
} }
public function process(XHPASTNode $root) { public function process(XHPASTNode $root) {
$inline_html = $root->selectDescendantsOfType('n_INLINE_HTML');
if ($inline_html) {
return;
}
foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) { foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) {
$this->raiseLintAtToken( $this->raiseLintAtToken(
$token, $token,