From 1c494d3daa6ba9c17049598d89fc580481f8abba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 2 May 2023 10:54:22 +0200 Subject: [PATCH] Update composer dependencies --- .../files/lib/system/api/composer.json | 2 +- .../files/lib/system/api/composer.lock | 14 +++++------ .../lib/system/api/composer/installed.json | 14 +++++------ .../lib/system/api/composer/installed.php | 6 ++--- .../system/api/sebastian/diff/ChangeLog.md | 14 +++++++++++ .../lib/system/api/sebastian/diff/README.md | 2 ++ .../lib/system/api/sebastian/diff/SECURITY.md | 6 ++--- .../system/api/sebastian/diff/src/Differ.php | 12 ++++------ .../system/api/sebastian/diff/src/Line.php | 6 ++--- ...ientLongestCommonSubsequenceCalculator.php | 7 +++++- ...ientLongestCommonSubsequenceCalculator.php | 24 ++++++++++++++----- 11 files changed, 67 insertions(+), 40 deletions(-) diff --git a/wcfsetup/install/files/lib/system/api/composer.json b/wcfsetup/install/files/lib/system/api/composer.json index dee0a73830..9e54e06bb5 100644 --- a/wcfsetup/install/files/lib/system/api/composer.json +++ b/wcfsetup/install/files/lib/system/api/composer.json @@ -28,7 +28,7 @@ "psr/http-server-middleware": "^1.0.2", "psr/log": "^3.0", "scssphp/scssphp": "^1.11", - "sebastian/diff": "^5.0.1", + "sebastian/diff": "^5.0.3", "symfony/polyfill-php82": "^1.27.0", "willdurand/negotiation": "^3.1" }, diff --git a/wcfsetup/install/files/lib/system/api/composer.lock b/wcfsetup/install/files/lib/system/api/composer.lock index 07fafda063..92a6820325 100644 --- a/wcfsetup/install/files/lib/system/api/composer.lock +++ b/wcfsetup/install/files/lib/system/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ac72a2546c309a03aa95cb912c9dc966", + "content-hash": "2983948012af211bf635948ccf965b06", "packages": [ { "name": "cuyz/valinor", @@ -1659,16 +1659,16 @@ }, { "name": "sebastian/diff", - "version": "5.0.1", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { @@ -1714,7 +1714,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -1722,7 +1722,7 @@ "type": "github" } ], - "time": "2023-03-23T05:12:41+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "symfony/css-selector", diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.json b/wcfsetup/install/files/lib/system/api/composer/installed.json index 344ed1d631..41c5e11c15 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.json +++ b/wcfsetup/install/files/lib/system/api/composer/installed.json @@ -1728,17 +1728,17 @@ }, { "name": "sebastian/diff", - "version": "5.0.1", - "version_normalized": "5.0.1.0", + "version": "5.0.3", + "version_normalized": "5.0.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02", - "reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { @@ -1748,7 +1748,7 @@ "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, - "time": "2023-03-23T05:12:41+00:00", + "time": "2023-05-01T07:48:21+00:00", "type": "library", "extra": { "branch-alias": { @@ -1786,7 +1786,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { diff --git a/wcfsetup/install/files/lib/system/api/composer/installed.php b/wcfsetup/install/files/lib/system/api/composer/installed.php index a5c2379782..d4d3e92030 100644 --- a/wcfsetup/install/files/lib/system/api/composer/installed.php +++ b/wcfsetup/install/files/lib/system/api/composer/installed.php @@ -269,9 +269,9 @@ 'dev_requirement' => false, ), 'sebastian/diff' => array( - 'pretty_version' => '5.0.1', - 'version' => '5.0.1.0', - 'reference' => 'aae9a0a43bff37bd5d8d0311426c87bf36153f02', + 'pretty_version' => '5.0.3', + 'version' => '5.0.3.0', + 'reference' => '912dc2fbe3e3c1e7873313cc801b100b6c68c87b', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/diff', 'aliases' => array(), diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/ChangeLog.md b/wcfsetup/install/files/lib/system/api/sebastian/diff/ChangeLog.md index ab8640c83d..9142e50f80 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/ChangeLog.md +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/ChangeLog.md @@ -2,6 +2,18 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [5.0.3] - 2023-05-01 + +### Changed + +* [#119](https://github.com/sebastianbergmann/diff/pull/119): Improve performance of `TimeEfficientLongestCommonSubsequenceCalculator` + +## [5.0.2] - 2023-05-01 + +### Changed + +* [#118](https://github.com/sebastianbergmann/diff/pull/118): Improve performance of `MemoryEfficientLongestCommonSubsequenceCalculator` + ## [5.0.1] - 2023-03-23 ### Fixed @@ -92,6 +104,8 @@ 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.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 [5.0.1]: https://github.com/sebastianbergmann/diff/compare/5.0.0...5.0.1 [5.0.0]: https://github.com/sebastianbergmann/diff/compare/4.0.4...5.0.0 [4.0.4]: https://github.com/sebastianbergmann/diff/compare/4.0.3...4.0.4 diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/README.md b/wcfsetup/install/files/lib/system/api/sebastian/diff/README.md index 3e84a35b4f..539dc59ede 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/README.md +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/README.md @@ -202,3 +202,5 @@ The code above yields the output below: ) ) ) + +Note: If the chunk size is 0 lines, i.e., `getStartRange()` or `getEndRange()` return 0, the number of line returned by `getStart()` or `getEnd()` is one lower than one would expect. It is the line number after which the chunk should be inserted or deleted; in all other cases, it gives the first line number of the replaced range of lines. diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/SECURITY.md b/wcfsetup/install/files/lib/system/api/sebastian/diff/SECURITY.md index 778f018b26..d88ff0019a 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/SECURITY.md +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/SECURITY.md @@ -4,7 +4,7 @@ If you believe you have found a security vulnerability in the library that is de **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** -Instead, please send an email to `sebastian@phpunit.de`. +Instead, please email `sebastian@phpunit.de`. Please include as much of the information listed below as you can to help us better understand and resolve the issue: @@ -22,9 +22,9 @@ This information will help us triage your report more quickly. The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit. -The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in a HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes. +The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in an HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes. If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context. -Vulnerabilities specific to the use outside of a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes. +Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes. diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Differ.php b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Differ.php index edf2dcc4b3..19ccf97c33 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Differ.php +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Differ.php @@ -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; diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Line.php b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Line.php index ecb2f79448..a9106a255b 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Line.php +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/Line.php @@ -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; diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php index dde08027d8..a46de07d6d 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php @@ -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]; + } } } } diff --git a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php index 51bac1f1dc..93b762887f 100644 --- a/wcfsetup/install/files/lib/system/api/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php +++ b/wcfsetup/install/files/lib/system/api/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php @@ -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]; + } + } } } -- 2.20.1