Skip to content

Commit

Permalink
Generic/LowercasedFilename: check files using short open echo tag
Browse files Browse the repository at this point in the history
Includes unit tests.
  • Loading branch information
jrfnl committed Apr 22, 2021
1 parent ae4f33b commit 297e7d3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file baseinstalldir="PHP/CodeSniffer" name="LineLengthUnitTest.3.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LineLengthUnitTest.4.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LineLengthUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LowercasedFilenameUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LowercasedFilenameUnitTest.1.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LowercasedFilenameUnitTest.2.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="LowercasedFilenameUnitTest.php" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="OneClassPerFileUnitTest.inc" role="test" />
<file baseinstalldir="PHP/CodeSniffer" name="OneClassPerFileUnitTest.php" role="test" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class LowercasedFilenameSniff implements Sniff
*/
public function register()
{
return [T_OPEN_TAG];
return [
T_OPEN_TAG,
T_OPEN_TAG_WITH_ECHO,
];

}//end register()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?=

?>

<?=

?>
12 changes: 10 additions & 2 deletions src/Standards/Generic/Tests/Files/LowercasedFilenameUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ class LowercasedFilenameUnitTest extends AbstractSniffUnitTest
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
public function getErrorList()
public function getErrorList($testFile='')
{
return [1 => 1];
switch ($testFile) {
case 'LowercasedFilenameUnitTest.1.inc':
case 'LowercasedFilenameUnitTest.2.inc':
return [1 => 1];
default:
return [];
}

}//end getErrorList()

Expand Down

0 comments on commit 297e7d3

Please sign in to comment.