Code Duplication    Length = 15-15 lines in 3 locations

src/Tokenizers/PHP.php 3 locations

@@ 752-766 (lines=15) @@
749
                these tokens in earlier versions.
750
            */
751
752
            if ($tokenIsArray === false
753
                && $token[0] === '*'
754
                && isset($tokens[($stackPtr + 1)]) === true
755
                && $tokens[($stackPtr + 1)] === '*'
756
            ) {
757
                $newToken            = array();
758
                $newToken['code']    = T_POW;
759
                $newToken['type']    = 'T_POW';
760
                $newToken['content'] = '**';
761
                $finalTokens[$newStackPtr] = $newToken;
762
763
                $newStackPtr++;
764
                $stackPtr++;
765
                continue;
766
            }
767
768
            /*
769
                Before PHP 5.6, the **= operator was tokenized as
@@ 797-811 (lines=15) @@
794
                So look for and combine these tokens in earlier versions.
795
            */
796
797
            if ($tokenIsArray === false
798
                && $token[0] === '?'
799
                && isset($tokens[($stackPtr + 1)]) === true
800
                && $tokens[($stackPtr + 1)][0] === '?'
801
            ) {
802
                $newToken            = array();
803
                $newToken['code']    = T_COALESCE;
804
                $newToken['type']    = 'T_COALESCE';
805
                $newToken['content'] = '??';
806
                $finalTokens[$newStackPtr] = $newToken;
807
808
                $newStackPtr++;
809
                $stackPtr++;
810
                continue;
811
            }
812
813
            /*
814
                Before PHP 7, the <=> operator was tokenized as
@@ 819-833 (lines=15) @@
816
                So look for and combine these tokens in earlier versions.
817
            */
818
819
            if ($tokenIsArray === true
820
                && $token[0] === T_IS_SMALLER_OR_EQUAL
821
                && isset($tokens[($stackPtr + 1)]) === true
822
                && $tokens[($stackPtr + 1)][0] === '>'
823
            ) {
824
                $newToken            = array();
825
                $newToken['code']    = T_SPACESHIP;
826
                $newToken['type']    = 'T_SPACESHIP';
827
                $newToken['content'] = '<=>';
828
                $finalTokens[$newStackPtr] = $newToken;
829
830
                $newStackPtr++;
831
                $stackPtr++;
832
                continue;
833
            }
834
835
            /*
836
                Emulate traits in PHP versions less than 5.4.