@@ -68,9 +68,9 @@ public function renderOutput(array $changes, object $subRenderer)
68
68
$ deprecationTriggered = false ;
69
69
foreach ($ blocks as $ change ) {
70
70
if (
71
- $ subRenderer instanceof MainRenderer &&
71
+ $ subRenderer instanceof self &&
72
72
!method_exists ($ subRenderer , 'generateLinesIgnore ' ) &&
73
- $ change ['tag ' ] == 'ignore '
73
+ $ change ['tag ' ] === 'ignore '
74
74
) {
75
75
if (!$ deprecationTriggered ) {
76
76
trigger_error (
@@ -157,7 +157,7 @@ protected function renderSequences(): array
157
157
$ blockSizeOld = $ endOld - $ startOld ;
158
158
$ blockSizeNew = $ endNew - $ startNew ;
159
159
160
- if (($ tag == 'replace ' ) && ($ blockSizeOld == $ blockSizeNew )) {
160
+ if (($ tag === 'replace ' ) && ($ blockSizeOld == $ blockSizeNew )) {
161
161
// Inline differences between old and new block.
162
162
$ this ->markInlineChanges ($ oldText , $ newText , $ startOld , $ endOld , $ startNew );
163
163
}
@@ -168,14 +168,14 @@ protected function renderSequences(): array
168
168
$ oldBlock = $ this ->formatLines (array_slice ($ oldText , $ startOld , $ blockSizeOld ));
169
169
$ newBlock = $ this ->formatLines (array_slice ($ newText , $ startNew , $ blockSizeNew ));
170
170
171
- if ($ tag != 'delete ' && $ tag != 'insert ' ) {
171
+ if ($ tag !== 'delete ' && $ tag != = 'insert ' ) {
172
172
// Old block "equals" New block or is replaced.
173
173
$ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
174
174
$ blocks [$ lastBlock ]['changed ' ]['lines ' ] += $ newBlock ;
175
175
continue ;
176
176
}
177
177
178
- if ($ tag == 'delete ' ) {
178
+ if ($ tag === 'delete ' ) {
179
179
// Block of version1 doesn't exist in version2.
180
180
$ blocks [$ lastBlock ]['base ' ]['lines ' ] += $ oldBlock ;
181
181
continue ;
@@ -266,14 +266,14 @@ private function markInnerChange(array &$oldText, array &$newText, int $startOld
266
266
267
267
foreach ($ opCodes as $ group ) {
268
268
foreach ($ group as [$ tag , $ changeStartOld , $ changeEndOld , $ changeStartNew , $ changeEndNew ]) {
269
- if ($ tag == 'equal ' ) {
269
+ if ($ tag === 'equal ' ) {
270
270
continue ;
271
271
}
272
- if ($ tag == 'replace ' || $ tag == 'delete ' ) {
272
+ if ($ tag === 'replace ' || $ tag = == 'delete ' ) {
273
273
$ oldLine [$ changeStartOld ] = "\0" . $ oldLine [$ changeStartOld ];
274
274
$ oldLine [$ changeEndOld ] = "\1" . $ oldLine [$ changeEndOld ];
275
275
}
276
- if ($ tag == 'replace ' || $ tag == 'insert ' ) {
276
+ if ($ tag === 'replace ' || $ tag = == 'insert ' ) {
277
277
$ newLine [$ changeStartNew ] = "\0" . $ newLine [$ changeStartNew ];
278
278
$ newLine [$ changeEndNew ] = "\1" . $ newLine [$ changeEndNew ];
279
279
}
@@ -380,7 +380,7 @@ private function getOuterChange(string $oldString, string $newString): array
380
380
}
381
381
382
382
$ end = -1 ;
383
- $ limit = $ limit - $ start ;
383
+ $ limit -= $ start ;
384
384
385
385
// Find the position of the last character which is different between old and new.
386
386
// Starts at the end of the shortest string.
@@ -453,10 +453,10 @@ function ($line) {
453
453
);
454
454
}
455
455
456
- if (strtolower ($ this ->options ['format ' ]) == 'html ' ) {
456
+ if (strtolower ($ this ->options ['format ' ]) === 'html ' ) {
457
457
// Convert special characters to HTML entities
458
458
$ strings = array_map (
459
- function ($ line ) {
459
+ static function ($ line ) {
460
460
return htmlspecialchars ($ line , ENT_NOQUOTES );
461
461
},
462
462
$ strings
@@ -466,7 +466,7 @@ function ($line) {
466
466
foreach ($ strings as &$ line ) {
467
467
$ line = preg_replace_callback (
468
468
'/(^[ \0\1]*)/ ' ,
469
- function ($ matches ) {
469
+ static function ($ matches ) {
470
470
return str_replace (' ' , ' ' , $ matches [0 ]);
471
471
},
472
472
$ line
0 commit comments