Code Duplication    Length = 18-18 lines in 2 locations

src/Standards/BestIt/Sniffs/Commenting/MethodDocSniff.php 2 locations

@@ 143-160 (lines=18) @@
140
        }
141
142
        // No extra newline before short description.
143
        if ($tokens[$short]['line'] !== ($tokens[$stackPtr]['line'] + 1)) {
144
            $error = 'Doc comment short description must be on the first line';
145
            $fix   = $phpcsFile->addFixableError($error, $short, self::CODE_SPACING_BEFORE_SHORT);
146
            if ($fix === true) {
147
                $phpcsFile->fixer->beginChangeset();
148
                for ($i = $stackPtr; $i < $short; $i++) {
149
                    if ($tokens[$i]['line'] === $tokens[$stackPtr]['line']) {
150
                        continue;
151
                    } elseif ($tokens[$i]['line'] === $tokens[$short]['line']) {
152
                        break;
153
                    }
154
155
                    $phpcsFile->fixer->replaceToken($i, '');
156
                }
157
158
                $phpcsFile->fixer->endChangeset();
159
            }
160
        }
161
162
        // Account for the fact that a short description might cover
163
        // multiple lines.
@@ 183-200 (lines=18) @@
180
181
        $long = $phpcsFile->findNext($empty, $shortEnd + 1, $commentEnd - 1, true);
182
        if ($long !== false && $tokens[$long]['code'] === T_DOC_COMMENT_STRING) {
183
            if ($tokens[$long]['line'] !== ($tokens[$shortEnd]['line'] + 2)) {
184
                $error = 'There must be exactly one blank line between descriptions in a doc comment';
185
                $fix   = $phpcsFile->addFixableError($error, $long, self::CODE_SPACING_BETWEEN);
186
                if ($fix === true) {
187
                    $phpcsFile->fixer->beginChangeset();
188
                    for ($i = ($shortEnd + 1); $i < $long; $i++) {
189
                        if ($tokens[$i]['line'] === $tokens[$shortEnd]['line']) {
190
                            continue;
191
                        } elseif ($tokens[$i]['line'] === ($tokens[$long]['line'] - 1)) {
192
                            break;
193
                        }
194
195
                        $phpcsFile->fixer->replaceToken($i, '');
196
                    }
197
198
                    $phpcsFile->fixer->endChangeset();
199
                }
200
            }
201
202
            if (preg_match('/^\p{Ll}/u', $tokens[$long]['content']) === 1) {
203
                $error = 'Doc comment long description must start with a capital letter';