Skip to content

Commit fca9a8e

Browse files
committed
Recognize generator functions
1 parent 67307b3 commit fca9a8e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Oxid/Sniffs/Commenting/FunctionCommentSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ protected function functionHasReturnStatement(PHP_CodeSniffer_File $phpcsFile, $
115115
$returnStatement = false;
116116
if (isset($sFunctionToken['scope_closer']) and isset($sFunctionToken['scope_opener'])) {
117117
$startSearch = $continueSearch !== null ? $continueSearch : $sFunctionToken['scope_opener'];
118-
$returnStatement = $phpcsFile->findNext(T_RETURN, $startSearch, $sFunctionToken['scope_closer']);
118+
$returnStatement =
119+
$phpcsFile->findNext(T_RETURN, $startSearch, $sFunctionToken['scope_closer'])
120+
|| $phpcsFile->findNext(T_YIELD, $startSearch, $sFunctionToken['scope_closer']);
119121
}
120122

121123
if ($returnStatement !== false) {

0 commit comments

Comments
 (0)