Update composer dependencies
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 2 May 2023 08:54:22 +0000 (10:54 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 2 May 2023 08:54:41 +0000 (10:54 +0200)
wcfsetup/install/files/lib/system/api/composer.json
wcfsetup/install/files/lib/system/api/composer.lock
wcfsetup/install/files/lib/system/api/composer/installed.json
wcfsetup/install/files/lib/system/api/composer/installed.php
wcfsetup/install/files/lib/system/api/sebastian/diff/ChangeLog.md
wcfsetup/install/files/lib/system/api/sebastian/diff/README.md
wcfsetup/install/files/lib/system/api/sebastian/diff/SECURITY.md
wcfsetup/install/files/lib/system/api/sebastian/diff/src/Differ.php
wcfsetup/install/files/lib/system/api/sebastian/diff/src/Line.php
wcfsetup/install/files/lib/system/api/sebastian/diff/src/MemoryEfficientLongestCommonSubsequenceCalculator.php
wcfsetup/install/files/lib/system/api/sebastian/diff/src/TimeEfficientLongestCommonSubsequenceCalculator.php

index dee0a7383068d7564014da46f6a38af9981bd1b7..9e54e06bb520f0cabe929c8bc934e67e9260db7d 100644 (file)
@@ -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"
     },
index 07fafda063fff71d2f2ba9811e337cd7994bbdb4..92a68203253d0c9d96cfe9d2eb2ced90e61cebbd 100644 (file)
@@ -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",
         },
         {
             "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": {
             "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": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2023-03-23T05:12:41+00:00"
+            "time": "2023-05-01T07:48:21+00:00"
         },
         {
             "name": "symfony/css-selector",
index 344ed1d6312ca8f6ac368842a8e183a1d9ab021e..41c5e11c1597e125119241af4322ed0cfa465225 100644 (file)
         },
         {
             "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": {
                 "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": {
             "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": [
                 {
index a5c23797827e224ddfd095628ad1a292a1519c06..d4d3e92030b931263f28746cad28e4c28eb35ca0 100644 (file)
             '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(),
index ab8640c83daa867c44cda575ec488f4fc37d8a64..9142e50f8080ead244e98cb521b713b78faa9a33 100644 (file)
@@ -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
index 3e84a35b4ff650e73538a0c8023c052670b53deb..539dc59edebe98a72514c06b24ff263b6451b8a9 100644 (file)
@@ -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.
index 778f018b26acbc336270d0cea7d06941fd6745be..d88ff0019ab197dfcdae122a01b634db778d591d 100644 (file)
@@ -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.
 
index edf2dcc4b34ede88591497d9022efce1fd53ef94..19ccf97c33cd6c9397ef658d5414fbb4ee071e20 100644 (file)
@@ -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;
 
index ecb2f79448359fbd853c423f41c0cb9bab941f22..a9106a255b2f480d19a1120774eabb17abd7f0f7 100644 (file)
@@ -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;
index dde08027d865e9365df23b65da8d676a90fc0427..a46de07d6df8700b86aa93885989281f1215b807 100644 (file)
@@ -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];
+                    }
                 }
             }
         }
index 51bac1f1dc60d1db89af8df9a599709c53d69d88..93b762887f0b573202311fb476305ca122b27da4 100644 (file)
@@ -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];
+                    }
+                }
             }
         }