Skip to content

Commit 657dabd

Browse files
authored
Merge pull request #32 from FloeDesignTechnologies/revert-25-patch-1
Revert "Bug #26: IncludeMismatchSniff fails to recognize file extensions when require line ends in a semicolon"
2 parents 76f3f15 + 93f256e commit 657dabd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Security/Sniffs/Misc/IncludeMismatchSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function register() {
2727
public function process(File $phpcsFile, $stackPtr) {
2828
$tokens = $phpcsFile->getTokens();
2929
$s = $phpcsFile->findNext(\PHP_CodeSniffer\Util\Tokens::$stringTokens, $stackPtr + 1);
30-
if (preg_match('/\.(\w+)(?:\'|\")/', $tokens[$s]['content'], $matches)) {
30+
if (preg_match('/\.(\w+)(?:\'|\")$/', $tokens[$s]['content'], $matches)) {
3131
$ext = $matches[1];
3232
if (!array_key_exists($ext, $phpcsFile->config->extensions)) {
3333
$phpcsFile->addError("The file extension '.$ext' that is not specified by --extensions has been used in a include/require function. Please add it to the scan process.", $stackPtr, 'ErrMiscIncludeMismatch');

0 commit comments

Comments
 (0)