Skip to content

Commit 6be01f6

Browse files
committed
Merge branch 'feature/generic-disallowtabindent-check-short-echo-tag' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents e04ecd0 + 551cdf7 commit 6be01f6

File tree

7 files changed

+61
-5
lines changed

7 files changed

+61
-5
lines changed

package.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
773773
<file baseinstalldir="PHP/CodeSniffer" name="DisallowSpaceIndentUnitTest.php" role="test" />
774774
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.css" role="test" />
775775
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.css.fixed" role="test" />
776-
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.inc" role="test" />
777-
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.inc.fixed" role="test" />
776+
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.1.inc" role="test" />
777+
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.1.inc.fixed" role="test" />
778+
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.2.inc" role="test" />
779+
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.2.inc.fixed" role="test" />
778780
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.js" role="test" />
779781
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.js.fixed" role="test" />
780782
<file baseinstalldir="PHP/CodeSniffer" name="DisallowTabIndentUnitTest.php" role="test" />

src/Standards/Generic/Sniffs/WhiteSpace/DisallowTabIndentSniff.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class DisallowTabIndentSniff implements Sniff
4141
*/
4242
public function register()
4343
{
44-
return [T_OPEN_TAG];
44+
return [
45+
T_OPEN_TAG,
46+
T_OPEN_TAG_WITH_ECHO,
47+
];
4548

4649
}//end register()
4750

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?=
2+
"$hello $there";
3+
?>
4+
<html>
5+
<head>
6+
<title>Foo</title>
7+
</head>
8+
<body>
9+
<div>
10+
<div>
11+
<div>
12+
</div>
13+
</div>
14+
</div>
15+
</body>
16+
</html>
17+
18+
<?=
19+
"$hello $there";
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?=
2+
"$hello $there";
3+
?>
4+
<html>
5+
<head>
6+
<title>Foo</title>
7+
</head>
8+
<body>
9+
<div>
10+
<div>
11+
<div>
12+
</div>
13+
</div>
14+
</div>
15+
</body>
16+
</html>
17+
18+
<?=
19+
"$hello $there";

src/Standards/Generic/Tests/WhiteSpace/DisallowTabIndentUnitTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function setCliValues($testFile, $config)
4040
*
4141
* @return array<int, int>
4242
*/
43-
public function getErrorList($testFile='DisallowTabIndentUnitTest.inc')
43+
public function getErrorList($testFile='')
4444
{
4545
switch ($testFile) {
46-
case 'DisallowTabIndentUnitTest.inc':
46+
case 'DisallowTabIndentUnitTest.1.inc':
4747
return [
4848
5 => 2,
4949
9 => 1,
@@ -84,6 +84,19 @@ public function getErrorList($testFile='DisallowTabIndentUnitTest.inc')
8484
93 => 1,
8585
];
8686
break;
87+
case 'DisallowTabIndentUnitTest.2.inc':
88+
return [
89+
6 => 1,
90+
7 => 1,
91+
8 => 1,
92+
9 => 1,
93+
10 => 1,
94+
11 => 1,
95+
12 => 1,
96+
13 => 1,
97+
19 => 1,
98+
];
99+
break;
87100
case 'DisallowTabIndentUnitTest.js':
88101
return [
89102
3 => 1,

0 commit comments

Comments
 (0)