Skip to content

Commit 1d3d27f

Browse files
authored
Merge pull request #947 from PHPCSStandards/feature/squiz-functioncommentthrowtag-improve-comment-tolerance
Squiz/FunctionCommentThrowTag: improve comment tolerance
2 parents 06833c6 + bfc2ec5 commit 1d3d27f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/Standards/Squiz/Sniffs/Commenting/FunctionCommentThrowTagSniff.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function process(File $phpcsFile, $stackPtr)
104104
don't know the exception class.
105105
*/
106106

107-
$nextToken = $phpcsFile->findNext(T_WHITESPACE, ($currPos + 1), null, true);
107+
$nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($currPos + 1), null, true);
108108
if ($tokens[$nextToken]['code'] === T_NEW
109109
|| $tokens[$nextToken]['code'] === T_NS_SEPARATOR
110110
|| $tokens[$nextToken]['code'] === T_STRING

src/Standards/Squiz/Tests/Commenting/FunctionCommentThrowTagUnitTest.inc

+8
Original file line numberDiff line numberDiff line change
@@ -523,3 +523,11 @@ $anon = new class {
523523
throw new PHP_Exception1('Error');
524524
}
525525
};
526+
527+
528+
/**
529+
* @throws Wrong_Exception
530+
*/
531+
public function ImproveCommentTolerance() {
532+
throw /*comment*/ new /*comment*/ Right_Exception('Error');
533+
}

src/Standards/Squiz/Tests/Commenting/FunctionCommentThrowTagUnitTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function getErrorList()
4343
287 => 1,
4444
397 => 1,
4545
519 => 1,
46+
530 => 1,
4647
];
4748

4849
}//end getErrorList()

0 commit comments

Comments
 (0)