@@ -123,7 +123,7 @@ private function fixupTokens(array $tokens) : array
123123 $ token ->pos += $ posDelta ;
124124 $ token ->line += $ lineDelta ;
125125 $ localPosDelta = 0 ;
126- $ len = \strlen (is_array ( $ token) ? $ token [ 1 ] : $ token );
126+ $ len = \strlen ($ token-> text );
127127 while ($ patchPos >= $ pos && $ patchPos < $ pos + $ len ) {
128128 $ patchTextLen = \strlen ($ patchText );
129129 if ($ patchType === 'remove ' ) {
@@ -134,18 +134,18 @@ private function fixupTokens(array $tokens) : array
134134 $ c --;
135135 } else {
136136 // Remove from token string
137- is_array ( $ token) ? $ token [ 1 ] : $ token = substr_replace (is_array ( $ token) ? $ token [ 1 ] : $ token , '' , $ patchPos - $ pos + $ localPosDelta , $ patchTextLen );
137+ $ token-> text = substr_replace ($ token-> text , '' , $ patchPos - $ pos + $ localPosDelta , $ patchTextLen );
138138 $ localPosDelta -= $ patchTextLen ;
139139 }
140140 $ lineDelta -= \substr_count ($ patchText , "\n" );
141141 } elseif ($ patchType === 'add ' ) {
142142 // Insert into the token string
143- is_array ( $ token) ? $ token [ 1 ] : $ token = substr_replace (is_array ( $ token) ? $ token [ 1 ] : $ token , $ patchText , $ patchPos - $ pos + $ localPosDelta , 0 );
143+ $ token-> text = substr_replace ($ token-> text , $ patchText , $ patchPos - $ pos + $ localPosDelta , 0 );
144144 $ localPosDelta += $ patchTextLen ;
145145 $ lineDelta += \substr_count ($ patchText , "\n" );
146146 } elseif ($ patchType === 'replace ' ) {
147147 // Replace inside the token string
148- is_array ( $ token) ? $ token [ 1 ] : $ token = substr_replace (is_array ( $ token) ? $ token [ 1 ] : $ token , $ patchText , $ patchPos - $ pos + $ localPosDelta , $ patchTextLen );
148+ $ token-> text = substr_replace ($ token-> text , $ patchText , $ patchPos - $ pos + $ localPosDelta , $ patchTextLen );
149149 } else {
150150 assert (\false);
151151 }
0 commit comments