🔧
This commit is contained in:
7
vendor/sebastian/diff/ChangeLog.md
vendored
7
vendor/sebastian/diff/ChangeLog.md
vendored
@@ -2,6 +2,12 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [5.1.1] - 2024-03-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use implicitly nullable parameters
|
||||
|
||||
## [5.1.0] - 2023-12-22
|
||||
|
||||
### Added
|
||||
@@ -124,6 +130,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
[5.1.1]: https://github.com/sebastianbergmann/diff/compare/5.1.0...5.1.1
|
||||
[5.1.0]: https://github.com/sebastianbergmann/diff/compare/5.0.3...5.1.0
|
||||
[5.0.3]: https://github.com/sebastianbergmann/diff/compare/5.0.2...5.0.3
|
||||
[5.0.2]: https://github.com/sebastianbergmann/diff/compare/5.0.1...5.0.2
|
||||
|
||||
2
vendor/sebastian/diff/LICENSE
vendored
2
vendor/sebastian/diff/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2002-2023, Sebastian Bergmann
|
||||
Copyright (c) 2002-2024, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
vendor/sebastian/diff/composer.json
vendored
2
vendor/sebastian/diff/composer.json
vendored
@@ -31,7 +31,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"symfony/process": "^4.2 || ^5"
|
||||
"symfony/process": "^6.4"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
|
||||
4
vendor/sebastian/diff/src/Differ.php
vendored
4
vendor/sebastian/diff/src/Differ.php
vendored
@@ -42,14 +42,14 @@ final class Differ
|
||||
$this->outputBuilder = $outputBuilder;
|
||||
}
|
||||
|
||||
public function diff(array|string $from, array|string $to, LongestCommonSubsequenceCalculator $lcs = null): string
|
||||
public function diff(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): string
|
||||
{
|
||||
$diff = $this->diffToArray($from, $to, $lcs);
|
||||
|
||||
return $this->outputBuilder->getDiff($diff);
|
||||
}
|
||||
|
||||
public function diffToArray(array|string $from, array|string $to, LongestCommonSubsequenceCalculator $lcs = null): array
|
||||
public function diffToArray(array|string $from, array|string $to, ?LongestCommonSubsequenceCalculator $lcs = null): array
|
||||
{
|
||||
if (is_string($from)) {
|
||||
$from = $this->splitStringByLines($from);
|
||||
|
||||
@@ -21,17 +21,17 @@ final class ConfigurationException extends InvalidArgumentException
|
||||
string $expected,
|
||||
$value,
|
||||
int $code = 0,
|
||||
Exception $previous = null
|
||||
?Exception $previous = null
|
||||
) {
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
'Option "%s" must be %s, got "%s".',
|
||||
$option,
|
||||
$expected,
|
||||
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value)
|
||||
is_object($value) ? $value::class : (null === $value ? '<null>' : gettype($value) . '#' . $value),
|
||||
),
|
||||
$code,
|
||||
$previous
|
||||
$previous,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
|
||||
|
||||
return array_merge(
|
||||
$this->calculate($fromStart, $toStart),
|
||||
$this->calculate($fromEnd, $toEnd)
|
||||
$this->calculate($fromEnd, $toEnd),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,11 @@ final class MemoryEfficientLongestCommonSubsequenceCalculator implements Longest
|
||||
if ($from[$i] === $to[$j]) {
|
||||
$current[$j + 1] = $prev[$j] + 1;
|
||||
} else {
|
||||
// don't use max() to avoid function call overhead
|
||||
/**
|
||||
* @noinspection PhpConditionCanBeReplacedWithMinMaxCallInspection
|
||||
*
|
||||
* We do not use max() here to avoid the function call overhead
|
||||
*/
|
||||
if ($current[$j] > $prev[$j + 1]) {
|
||||
$current[$j + 1] = $current[$j];
|
||||
} else {
|
||||
|
||||
@@ -82,7 +82,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
|
||||
$options['fromFile'],
|
||||
null === $options['fromFileDate'] ? '' : "\t" . $options['fromFileDate'],
|
||||
$options['toFile'],
|
||||
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate']
|
||||
null === $options['toFileDate'] ? '' : "\t" . $options['toFileDate'],
|
||||
);
|
||||
|
||||
$this->collapseRanges = $options['collapseRanges'];
|
||||
@@ -201,11 +201,11 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
|
||||
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
|
||||
$toStart - $contextStartOffset,
|
||||
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
|
||||
$output
|
||||
$output,
|
||||
);
|
||||
|
||||
$fromStart += $fromRange;
|
||||
$toStart += $toRange;
|
||||
$toStart += $toRange;
|
||||
|
||||
$hunkCapture = false;
|
||||
$sameCount = $toRange = $fromRange = 0;
|
||||
@@ -251,7 +251,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
|
||||
$contextEndOffset = min($sameCount, $this->contextLines);
|
||||
|
||||
$fromRange -= $sameCount;
|
||||
$toRange -= $sameCount;
|
||||
$toRange -= $sameCount;
|
||||
|
||||
$this->writeHunk(
|
||||
$diff,
|
||||
@@ -261,7 +261,7 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
|
||||
$fromRange + $contextStartOffset + $contextEndOffset,
|
||||
$toStart - $contextStartOffset,
|
||||
$toRange + $contextStartOffset + $contextEndOffset,
|
||||
$output
|
||||
$output,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -302,11 +302,11 @@ final class StrictUnifiedDiffOutputBuilder implements DiffOutputBuilderInterface
|
||||
$this->changed = true;
|
||||
fwrite($output, $diff[$i][0]);
|
||||
}
|
||||
//} elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
|
||||
// } elseif ($diff[$i][1] === Differ::DIFF_LINE_END_WARNING) { // custom comment inserted by PHPUnit/diff package
|
||||
// skip
|
||||
//} else {
|
||||
// } else {
|
||||
// unknown/invalid
|
||||
//}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ use function max;
|
||||
use function min;
|
||||
use function str_ends_with;
|
||||
use function stream_get_contents;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use SebastianBergmann\Diff\Differ;
|
||||
|
||||
@@ -67,7 +66,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
|
||||
// This might happen when both the `from` and `to` do not have a trailing linebreak
|
||||
$last = substr($diff, -1);
|
||||
|
||||
return 0 !== strlen($diff) && "\n" !== $last && "\r" !== $last
|
||||
return '' !== $diff && "\n" !== $last && "\r" !== $last
|
||||
? $diff . "\n"
|
||||
: $diff;
|
||||
}
|
||||
@@ -151,11 +150,11 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
|
||||
$fromRange - $cutOff + $contextStartOffset + $this->contextLines,
|
||||
$toStart - $contextStartOffset,
|
||||
$toRange - $cutOff + $contextStartOffset + $this->contextLines,
|
||||
$output
|
||||
$output,
|
||||
);
|
||||
|
||||
$fromStart += $fromRange;
|
||||
$toStart += $toRange;
|
||||
$toStart += $toRange;
|
||||
|
||||
$hunkCapture = false;
|
||||
$sameCount = $toRange = $fromRange = 0;
|
||||
@@ -199,7 +198,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
|
||||
$contextEndOffset = min($sameCount, $this->contextLines);
|
||||
|
||||
$fromRange -= $sameCount;
|
||||
$toRange -= $sameCount;
|
||||
$toRange -= $sameCount;
|
||||
|
||||
$this->writeHunk(
|
||||
$diff,
|
||||
@@ -209,7 +208,7 @@ final class UnifiedDiffOutputBuilder extends AbstractChunkOutputBuilder
|
||||
$fromRange + $contextStartOffset + $contextEndOffset,
|
||||
$toStart - $contextStartOffset,
|
||||
$toRange + $contextStartOffset + $contextEndOffset,
|
||||
$output
|
||||
$output,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
2
vendor/sebastian/diff/src/Parser.php
vendored
2
vendor/sebastian/diff/src/Parser.php
vendored
@@ -83,7 +83,7 @@ final class Parser
|
||||
(int) $match['start'],
|
||||
isset($match['startrange']) ? max(0, (int) $match['startrange']) : 1,
|
||||
(int) $match['end'],
|
||||
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1
|
||||
isset($match['endrange']) ? max(0, (int) $match['endrange']) : 1,
|
||||
);
|
||||
|
||||
$chunks[] = $chunk;
|
||||
|
||||
Reference in New Issue
Block a user