From 402899a9c32d6079a913546cadf0ea54f127e97b Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Thu, 6 Aug 2015 06:56:26 +1000 Subject: [PATCH] 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 --- src/lint/linter/__tests__/xhpast/embedded-tags.lint-test | 1 - src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test | 1 - .../xhpast/rules/ArcanistPHPCloseTagXHPASTLinterRule.php | 6 ++++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test b/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test index b9f6be44..d15cefb5 100644 --- a/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test +++ b/src/lint/linter/__tests__/xhpast/embedded-tags.lint-test @@ -2,4 +2,3 @@ This shouldn't fatal the parser. ~~~~~~~~~~ -error:1:10 diff --git a/src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test b/src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test index e749bfa6..7fb52e73 100644 --- a/src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test +++ b/src/lint/linter/__tests__/xhpast/php-tags-bad.lint-test @@ -4,7 +4,6 @@ garbage garbage ?> ~~~~~~~~~~ error:1:1 -error:4:1 ~~~~~~~~~~ garbage garbage selectDescendantsOfType('n_INLINE_HTML'); + + if ($inline_html) { + return; + } + foreach ($root->selectTokensOfType('T_CLOSE_TAG') as $token) { $this->raiseLintAtToken( $token,