From a9a1c4c4460694d59de0cb3fbb24b648143d8189 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 22 Apr 2021 01:36:17 +0200 Subject: [PATCH] Generic/GitMergeConflict: check files using only short open echo tag Includes unit tests. --- package.xml | 1 + .../VersionControl/GitMergeConflictSniff.php | 5 ++++- .../GitMergeConflictUnitTest.7.inc | 19 +++++++++++++++++++ .../GitMergeConflictUnitTest.php | 10 ++++++++++ .../WhiteSpace/SuperfluousWhitespaceSniff.php | 1 + 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc diff --git a/package.xml b/package.xml index c408f94353..e408d1ba89 100644 --- a/package.xml +++ b/package.xml @@ -724,6 +724,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + diff --git a/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php b/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php index e25d556b8b..83265b2e47 100644 --- a/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php +++ b/src/Standards/Generic/Sniffs/VersionControl/GitMergeConflictSniff.php @@ -34,7 +34,10 @@ class GitMergeConflictSniff implements Sniff */ public function register() { - return [T_OPEN_TAG]; + return [ + T_OPEN_TAG, + T_OPEN_TAG_WITH_ECHO, + ]; }//end register() diff --git a/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc new file mode 100644 index 0000000000..85cae1fdc8 --- /dev/null +++ b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.7.inc @@ -0,0 +1,19 @@ + +
+<<<<<<< HEAD +

Testing a merge conflict.

+======= +

Another text string.

+>>>>>>> ref/heads/feature-branch +
+ + +
+<<<<<<< HEAD +

+======= +

+>>>>>>> ref/heads/feature-branch +
+ + diff --git a/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php index a36caafbd2..50986f48bb 100644 --- a/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php +++ b/src/Standards/Generic/Tests/VersionControl/GitMergeConflictUnitTest.php @@ -99,6 +99,16 @@ public function getErrorList($testFile='GitMergeConflictUnitTest.1.inc') 32 => 1, ]; + case 'GitMergeConflictUnitTest.7.inc': + return [ + 3 => 1, + 5 => 1, + 7 => 1, + 12 => 1, + 14 => 1, + 16 => 1, + ]; + case 'GitMergeConflictUnitTest.1.css': return [ 3 => 1, diff --git a/src/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php b/src/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php index 831e832766..e99d829bca 100644 --- a/src/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php +++ b/src/Standards/Squiz/Sniffs/WhiteSpace/SuperfluousWhitespaceSniff.php @@ -49,6 +49,7 @@ public function register() { return [ T_OPEN_TAG, + T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_WHITESPACE, T_COMMENT,