Code Duplication    Length = 18-18 lines in 2 locations

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

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