Code Duplication    Length = 3-4 lines in 3 locations

PHPCompatibility/Sniffs/PHP/NewLanguageConstructsSniff.php 3 locations

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