Code Duplication    Length = 3-4 lines in 5 locations

Sniffs/PHP/NewNowdocQuotedHeredocSniff.php 2 locations

@@ 101-103 (lines=3) @@
98
            /*
99
             * Check for the right token combination.
100
             */
101
            if (isset($tokens[($stackPtr + 1)]) === false || $tokens[($stackPtr + 1)]['code'] !== T_LESS_THAN) {
102
                return;
103
            }
104
105
            if (isset($tokens[($stackPtr + 2)]) === false
106
                || $tokens[($stackPtr + 2)]['code'] !== T_CONSTANT_ENCAPSED_STRING) {
@@ 105-108 (lines=4) @@
102
                return;
103
            }
104
105
            if (isset($tokens[($stackPtr + 2)]) === false
106
                || $tokens[($stackPtr + 2)]['code'] !== T_CONSTANT_ENCAPSED_STRING) {
107
                return;
108
            }
109
110
            /*
111
             * Heredoc and nowdoc naming rules:

Sniffs/PHP/NewLanguageConstructsSniff.php 3 locations

@@ 256-259 (lines=4) @@
253
     */
254
    private function isTCoalesceEqual($tokens, $stackPtr)
255
    {
256
        if ($tokens[$stackPtr]['code'] !== T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) {
257
            // Function called for wrong token or token has no predecesor.
258
            return false;
259
        }
260
261
        if ($tokens[($stackPtr - 1)]['type'] === 'T_COALESCE') {
262
            return true;
@@ 283-286 (lines=4) @@
280
     */
281
    private function isTCoalesce($tokens, $stackPtr)
282
    {
283
        if ($tokens[$stackPtr]['code'] !== T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) {
284
            // Function called for wrong token or token has no predecesor.
285
            return false;
286
        }
287
288
        if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
289
            // Make sure not to confuse it with the T_COALESCE_EQUAL token.
@@ 290-292 (lines=3) @@
287
288
        if ($tokens[($stackPtr - 1)]['code'] === T_INLINE_THEN) {
289
            // Make sure not to confuse it with the T_COALESCE_EQUAL token.
290
            if (isset($tokens[($stackPtr + 1)]) === false || $tokens[($stackPtr + 1)]['code'] !== T_EQUAL) {
291
                return true;
292
            }
293
        }
294
295
        return false;