original_string: protected function functionHasReturnStatement(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $continueSearch = null)
      {
          $tokens = $phpcsFile->getTokens();
          $sFunctionToken = $tokens[$stackPtr];
  
          $returnStatement = false;
          if (isset($sFunctionToken['scope_closer']) and isset($sFunctionToken['scope_opener'])) {
              $startSearch = $continueSearch !== null ? $continueSearch : $sFunctionToken['scope_opener'];
              $returnStatement =
                  $phpcsFile->findNext(T_RETURN, $startSearch, $sFunctionToken['scope_closer'])
                  || $phpcsFile->findNext(T_YIELD,  $startSearch, $sFunctionToken['scope_closer']);
          }
  
          if ($returnStatement !== false) {
              if ($phpcsFile->hasCondition($returnStatement, T_CLOSURE)) {
                  return $this->functionHasReturnStatement($phpcsFile, $stackPtr, $returnStatement+1);
              } else {
                  return true;
              }
          }
  
          return false;
      }
code: protected function functionHasReturnStatement(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $continueSearch = null)
      {
          $tokens = $phpcsFile->getTokens();
          $sFunctionToken = $tokens[$stackPtr];
  
          $returnStatement = false;
          if (isset($sFunctionToken['scope_closer']) and isset($sFunctionToken['scope_opener'])) {
              $startSearch = $continueSearch !== null ? $continueSearch : $sFunctionToken['scope_opener'];
              $returnStatement =
                  $phpcsFile->findNext(T_RETURN, $startSearch, $sFunctionToken['scope_closer'])
                  || $phpcsFile->findNext(T_YIELD,  $startSearch, $sFunctionToken['scope_closer']);
          }
  
          if ($returnStatement !== false) {
              if ($phpcsFile->hasCondition($returnStatement, T_CLOSURE)) {
                  return $this->functionHasReturnStatement($phpcsFile, $stackPtr, $returnStatement+1);
              } else {
                  return true;
              }
          }
  
          return false;
      }
code_tokens: protected function functionHasReturnStatement ( PHP_CodeSniffer_File $ phpcsFile , $ stackPtr , $ continueSearch = null ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ sFunctionToken = $ tokens [ $ stackPtr ] ; $ returnStatement = false ; if ( isset ( $ sFunctionToken [ 'scope_closer' ] ) and isset ( $ sFunctionToken [ 'scope_opener' ] ) ) { $ startSearch = $ continueSearch !== null ? $ continueSearch : $ sFunctionToken [ 'scope_opener' ] ; $ returnStatement = $ phpcsFile -> findNext ( T_RETURN , $ startSearch , $ sFunctionToken [ 'scope_closer' ] ) || $ phpcsFile -> findNext ( T_YIELD , $ startSearch , $ sFunctionToken [ 'scope_closer' ] ) ; } if ( $ returnStatement !== false ) { if ( $ phpcsFile -> hasCondition ( $ returnStatement , T_CLOSURE ) ) { return $ this -> functionHasReturnStatement ( $ phpcsFile , $ stackPtr , $ returnStatement + 1 ) ; } else { return true ; } } return false ; }
docstring: Search if Function has a Return Statement
  
  @param PHP_CodeSniffer_File $phpcsFile      The file being scanned.
  @param int                  $stackPtr       The position of the current token
  in the stack passed in $tokens.
  @param int                  $continueSearch If found a return in Condition of a closure
  than continue to search
  
  @return bool
docstring_tokens: Search if Function has a Return Statement