Skip to content

Commit

Permalink
Allow closing tags in files containing HTML
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joshuaspence committed Aug 5, 2015
1 parent fb5d5b8 commit 402899a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/lint/linter/__tests__/xhpast/embedded-tags.lint-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

This shouldn't fatal the parser.
~~~~~~~~~~
error:1:10
1 change: 0 additions & 1 deletion src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ garbage garbage
?>
~~~~~~~~~~
error:1:1
error:4:1
~~~~~~~~~~
garbage garbage
<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ public function getLintName() {
}

public function process(XHPASTNode $root) {
$inline_html = $root->selectDescendantsOfType('n_INLINE_HTML');

if ($inline_html) {
return;
}

foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) {
$this->raiseLintAtToken(
$token,
Expand Down

0 comments on commit 402899a

Please sign in to comment.