Skip to content

Commit 557ab69

Browse files
committed
Sniff wasn't dealing with abstract functions (ref #1650)
1 parent 5812672 commit 557ab69

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public function process(File $phpcsFile, $stackPtr)
4242
{
4343
$tokens = $phpcsFile->getTokens();
4444

45+
if (isset($tokens[$stackPtr]['scope_closer']) === false) {
46+
// Abstract or incomplete.
47+
return;
48+
}
49+
4550
$find = Tokens::$methodPrefixes;
4651
$find[] = T_WHITESPACE;
4752

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,10 @@ class A
403403
}
404404
}
405405
}
406+
407+
abstract class SomeClass {
408+
/**
409+
* Comment here.
410+
*/
411+
abstract public function getGroups();
412+
}

0 commit comments

Comments
 (0)