From 3fb8a2d940d2ee144b2a114636958e3754fe40a2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 22 Apr 2021 04:11:20 +0200 Subject: [PATCH] Generic/DisallowSpaceIndent: check files using only short open echo tag Includes unit tests. --- package.xml | 2 ++ .../WhiteSpace/DisallowSpaceIndentSniff.php | 5 ++++- .../DisallowSpaceIndentUnitTest.3.inc | 19 +++++++++++++++++++ .../DisallowSpaceIndentUnitTest.3.inc.fixed | 19 +++++++++++++++++++ .../DisallowSpaceIndentUnitTest.php | 11 +++++++++++ 5 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.3.inc create mode 100644 src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.3.inc.fixed diff --git a/package.xml b/package.xml index c408f94353..87b422723e 100644 --- a/package.xml +++ b/package.xml @@ -739,6 +739,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> + + diff --git a/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php b/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php index 4fe89e767a..bbdbfe0a9a 100644 --- a/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php +++ b/src/Standards/Generic/Sniffs/WhiteSpace/DisallowSpaceIndentSniff.php @@ -41,7 +41,10 @@ class DisallowSpaceIndentSniff 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/WhiteSpace/DisallowSpaceIndentUnitTest.3.inc b/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.3.inc new file mode 100644 index 0000000000..4df731a3c0 --- /dev/null +++ b/src/Standards/Generic/Tests/WhiteSpace/DisallowSpaceIndentUnitTest.3.inc @@ -0,0 +1,19 @@ + + + + Foo + + +
+
+
+
+
+
+ + + + + + + Foo + + +
+
+
+
+
+
+ + + + 1, ]; break; + case 'DisallowSpaceIndentUnitTest.3.inc': + return [ + 2 => 1, + 5 => 1, + 10 => 1, + 12 => 1, + 13 => 1, + 14 => 1, + 15 => 1, + ]; + break; case 'DisallowSpaceIndentUnitTest.js': return [3 => 1]; break;