protected function findCommentEndIndex(File $file, $elementIndex)
    {
        $searchTypes   = array_merge(Tokens::$methodPrefixes, [T_WHITESPACE]);
        $previousToken = $file->findPrevious($searchTypes, $elementIndex - 1, null, true);
        if ($previousToken
            && $file->getTokens()[$previousToken]['code'] == T_DOC_COMMENT_CLOSE_TAG
        ) {
            return $previousToken;
        }

        return false;
    }