Code Duplication    Length = 3-4 lines in 5 locations

Sniffs/PHP/NewLanguageConstructsSniff.php 3 locations

@@ 264-267 (lines=4) @@
261
     */
262
    private function isTCoalesceEqual($tokens, $stackPtr)
263
    {
264
        if ($tokens[$stackPtr]['code'] !== T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) {
265
            // Function called for wrong token or token has no predecesor.
266
            return false;
267
        }
268
269
        if ($tokens[($stackPtr - 1)]['type'] === 'T_COALESCE') {
270
            return true;
@@ 291-294 (lines=4) @@
288
     */
289
    private function isTCoalesce($tokens, $stackPtr)
290
    {
291
        if ($tokens[$stackPtr]['code'] !== T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) {
292
            // Function called for wrong token or token has no predecesor.
293
            return false;
294
        }
295
296
        if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
297
            // Make sure not to confuse it with the T_COALESCE_EQUAL token.
@@ 298-300 (lines=3) @@
295
296
        if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
297
            // Make sure not to confuse it with the T_COALESCE_EQUAL token.
298
            if (isset($tokens[($stackPtr + 1)]) === false || $tokens[($stackPtr + 1)]['code'] !== T_EQUAL) {
299
                return true;
300
            }
301
        }
302
303
        return false;

Sniffs/PHP/NewNowdocSniff.php 2 locations

@@ 71-73 (lines=3) @@
68
         * backfill for it, so we have to sniff for a specific combination of tokens.
69
         */
70
        if ($tokens[$stackPtr]['code'] === T_SL) {
71
            if (isset($tokens[($stackPtr+1)]) === false || $tokens[($stackPtr + 1)]['code'] !== T_LESS_THAN) {
72
                return;
73
            }
74
75
            if (isset($tokens[($stackPtr+2)]) === false
76
                || $tokens[($stackPtr + 2)]['code'] !== T_CONSTANT_ENCAPSED_STRING) {
@@ 75-78 (lines=4) @@
72
                return;
73
            }
74
75
            if (isset($tokens[($stackPtr+2)]) === false
76
                || $tokens[($stackPtr + 2)]['code'] !== T_CONSTANT_ENCAPSED_STRING) {
77
                return;
78
            }
79
80
            /*
81
             * Heredoc and nowdoc naming rules: