Skip to content

Commit f653fd2

Browse files
committed
Fixed bug #3503 : Squiz.Commenting.FunctionComment.ThrowsNoFullStop false positive when one line @throw
1 parent c715f09 commit f653fd2

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
3939
-- Squiz.Commenting.DocCommentAlignment
4040
-- Squiz.Commenting.VariableComment
4141
-- Thanks to Juliette Reinders Folmer for the patches
42+
- Fixed bug #3503 : Squiz.Commenting.FunctionComment.ThrowsNoFullStop false positive when one line @throw
4243
</notes>
4344
<contents>
4445
<dir name="/">

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ protected function processThrows(File $phpcsFile, $stackPtr, $commentStart)
245245
}
246246
}
247247

248+
$comment = trim($comment);
249+
248250
// Starts with a capital letter and ends with a fullstop.
249251
$firstChar = $comment[0];
250252
if (strtoupper($firstChar) !== $firstChar) {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,3 +1041,8 @@ public function ignored() {
10411041
}
10421042

10431043
// phpcs:set Squiz.Commenting.FunctionComment specialMethods[] __construct,__destruct
1044+
1045+
/**
1046+
* @return void
1047+
* @throws Exception If any other error occurs. */
1048+
function throwCommentOneLine() {}

src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,3 +1041,8 @@ public function ignored() {
10411041
}
10421042

10431043
// phpcs:set Squiz.Commenting.FunctionComment specialMethods[] __construct,__destruct
1044+
1045+
/**
1046+
* @return void
1047+
* @throws Exception If any other error occurs. */
1048+
function throwCommentOneLine() {}

0 commit comments

Comments
 (0)