Skip to content

Commit

Permalink
Merge pull request #2 from jhammer/v.1
Browse files Browse the repository at this point in the history
Make compatible with PHP 7.2
  • Loading branch information
qazd authored Nov 17, 2018
2 parents a267978 + b96de19 commit f07cd39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/wp/Text/Diff/Engine/native.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks)
}
$matches = $ymatches[$line];
reset($matches);
while (list(, $y) = each($matches)) {
foreach ($matches as $ignore => $y) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcsPos($y);
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
break;
}
}
while (list(, $y) = each($matches)) {
foreach ($matches as $ignore => $y) {
if ($y > $this->seq[$k - 1]) {
assert($y <= $this->seq[$k]);
/* Optimization: this is a common case: next match is
Expand Down Expand Up @@ -330,7 +330,7 @@ function _shiftBoundaries($lines, &$changed, $other_changed)
$i = 0;
$j = 0;

assert('count($lines) == count($changed)');
assert(count($lines) == count($changed));
$len = count($lines);
$other_len = count($other_changed);

Expand All @@ -351,7 +351,7 @@ function _shiftBoundaries($lines, &$changed, $other_changed)
}

while ($i < $len && ! $changed[$i]) {
assert('$j < $other_len && ! $other_changed[$j]');
assert($j < $other_len && ! $other_changed[$j]);
$i++; $j++;
while ($j < $other_len && $other_changed[$j]) {
$j++;
Expand Down Expand Up @@ -383,11 +383,11 @@ function _shiftBoundaries($lines, &$changed, $other_changed)
while ($start > 0 && $changed[$start - 1]) {
$start--;
}
assert('$j > 0');
assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
assert('$j >= 0 && !$other_changed[$j]');
assert($j >= 0 && !$other_changed[$j]);
}

/* Set CORRESPONDING to the end of the changed run, at the
Expand All @@ -408,7 +408,7 @@ function _shiftBoundaries($lines, &$changed, $other_changed)
$i++;
}

assert('$j < $other_len && ! $other_changed[$j]');
assert($j < $other_len && ! $other_changed[$j]);
$j++;
if ($j < $other_len && $other_changed[$j]) {
$corresponding = $i;
Expand All @@ -424,11 +424,11 @@ function _shiftBoundaries($lines, &$changed, $other_changed)
while ($corresponding < $i) {
$changed[--$start] = 1;
$changed[--$i] = 0;
assert('$j > 0');
assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
assert('$j >= 0 && !$other_changed[$j]');
assert($j >= 0 && !$other_changed[$j]);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp/Text/Diff/Engine/shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function diff($from_lines, $to_lines)

if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
// copied lines
assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
assert($match[1] - $from_line_no == $match[4] - $to_line_no);
array_push($edits,
new Text_Diff_Op_copy(
$this->_getLines($from_lines, $from_line_no, $match[1] - 1),
Expand Down

0 comments on commit f07cd39

Please sign in to comment.