Composer updates
This commit is contained in:
12
vendor/sebastian/diff/src/Differ.php
vendored
12
vendor/sebastian/diff/src/Differ.php
vendored
@@ -30,14 +30,10 @@ use SebastianBergmann\Diff\Output\DiffOutputBuilderInterface;
|
||||
|
||||
final class Differ
|
||||
{
|
||||
public const OLD = 0;
|
||||
|
||||
public const ADDED = 1;
|
||||
|
||||
public const REMOVED = 2;
|
||||
|
||||
public const DIFF_LINE_END_WARNING = 3;
|
||||
|
||||
public const OLD = 0;
|
||||
public const ADDED = 1;
|
||||
public const REMOVED = 2;
|
||||
public const DIFF_LINE_END_WARNING = 3;
|
||||
public const NO_LINE_END_EOF_WARNING = 4;
|
||||
private DiffOutputBuilderInterface $outputBuilder;
|
||||
|
||||
|
||||
6
vendor/sebastian/diff/src/Line.php
vendored
6
vendor/sebastian/diff/src/Line.php
vendored
@@ -11,10 +11,8 @@ namespace SebastianBergmann\Diff;
|
||||
|
||||
final class Line
|
||||
{
|
||||
public const ADDED = 1;
|
||||
|
||||
public const REMOVED = 2;
|
||||
|
||||
public const ADDED = 1;
|
||||
public const REMOVED = 2;
|
||||
public const UNCHANGED = 3;
|
||||
private int $type;
|
||||
private string $content;
|
||||
|
||||
@@ -78,7 +78,12 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
|
||||
if ($from[$i] === $to[$j]) {
|
||||
$current[$j + 1] = $prev[$j] + 1;
|
||||
} else {
|
||||
$current[$j + 1] = max($current[$j], $prev[$j + 1]);
|
||||
// don't use max() to avoid function call overhead
|
||||
if ($current[$j] > $prev[$j + 1]) {
|
||||
$current[$j + 1] = $current[$j];
|
||||
} else {
|
||||
$current[$j + 1] = $prev[$j + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,24 @@ final class TimeEfficientLongestCommonSubsequenceCalculator implements LongestCo
|
||||
|
||||
for ($i = 1; $i <= $fromLength; $i++) {
|
||||
for ($j = 1; $j <= $toLength; $j++) {
|
||||
$o = ($j * $width) + $i;
|
||||
$matrix[$o] = max(
|
||||
$matrix[$o - 1],
|
||||
$matrix[$o - $width],
|
||||
$from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0
|
||||
);
|
||||
$o = ($j * $width) + $i;
|
||||
|
||||
// don't use max() to avoid function call overhead
|
||||
$firstOrLast = $from[$i - 1] === $to[$j - 1] ? $matrix[$o - $width - 1] + 1 : 0;
|
||||
|
||||
if ($matrix[$o - 1] > $matrix[$o - $width]) {
|
||||
if ($firstOrLast > $matrix[$o - 1]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - 1];
|
||||
}
|
||||
} else {
|
||||
if ($firstOrLast > $matrix[$o - $width]) {
|
||||
$matrix[$o] = $firstOrLast;
|
||||
} else {
|
||||
$matrix[$o] = $matrix[$o - $width];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user