File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed
Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -147,19 +147,11 @@ private function prepareReplacements(array $statements): array
147147 private function performReplacements (string $ s , array $ replacements ): string
148148 {
149149 usort ($ replacements , function ($ a , $ b ) { // sort by position in file
150- return $ a [0 ] <=> $ b [0 ];
150+ return $ b [0 ] <=> $ a [0 ];
151151 });
152152
153- $ correctiveOffset = 0 ;
154153 foreach ($ replacements as [$ start , $ end , $ replacement ]) {
155- $ replacingStringLength = $ end - $ start + 1 ;
156- $ s = substr_replace (
157- $ s ,
158- $ replacement ,
159- $ correctiveOffset + $ start ,
160- $ replacingStringLength
161- );
162- $ correctiveOffset += strlen ($ replacement ) - $ replacingStringLength ;
154+ $ s = substr_replace ($ s , $ replacement , $ start , $ end - $ start + 1 );
163155 }
164156 return $ s ;
165157 }
You can’t perform that action at this time.
0 commit comments