Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -27,9 +27,11 @@ class Diff {
* Constructor.
* Computes diff between sequences of strings.
*
* @param $from_lines array An array of strings.
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
* @param array $from_lines
* An array of strings.
* (Typically these are lines from a file.)
* @param array $to_lines
* An array of strings.
*/
public function __construct($from_lines, $to_lines) {
$eng = new DiffEngine();
@ -44,8 +46,8 @@ class Diff {
*
* $diff = new Diff($lines1, $lines2);
* $rev = $diff->reverse();
* @return object A Diff object representing the inverse of the
* original diff.
* @return object
* A Diff object representing the inverse of the original diff.
*/
public function reverse() {
$rev = $this;
@ -146,7 +148,6 @@ class Diff {
trigger_error("Reversed closing doesn't match", E_USER_ERROR);
}
$prevtype = 'none';
foreach ($this->edits as $edit) {
if ( $prevtype == $edit->type ) {

View file

@ -2,8 +2,6 @@
namespace Drupal\Component\Diff\Engine;
use Drupal\Component\Utility\Unicode;
/**
* Class used internally by Diff to actually compute the diffs.
*
@ -134,7 +132,7 @@ class DiffEngine {
* Returns the whole line if it's small enough, or the MD5 hash otherwise.
*/
protected function _line_hash($line) {
if (Unicode::strlen($line) > $this::MAX_XREF_LENGTH) {
if (mb_strlen($line) > $this::MAX_XREF_LENGTH) {
return md5($line);
}
else {
@ -195,34 +193,36 @@ class DiffEngine {
}
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks);
for ( ; $x < $x1; $x++) {
for (; $x < $x1; $x++) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if (empty($ymatches[$line])) {
continue;
}
$matches = $ymatches[$line];
reset($matches);
while (list ($junk, $y) = each($matches)) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
break;
$found_empty = FALSE;
foreach ($matches as $y) {
if (!$found_empty) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
$found_empty = TRUE;
}
}
}
while (list ($junk, $y) = each($matches)) {
if ($y > $this->seq[$k - 1]) {
$this::USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
$this->in_seq[$this->seq[$k]] = FALSE;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
}
elseif (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
else {
if ($y > $this->seq[$k - 1]) {
$this::USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
// next match is just replacing previous match.
$this->in_seq[$this->seq[$k]] = FALSE;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
}
elseif (empty($this->in_seq[$y])) {
$k = $this->_lcs_pos($y);
$this::USE_ASSERTS && assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
}
}
}
}
@ -302,8 +302,7 @@ class DiffEngine {
//$nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
//$nchunks = max(2, min(8, (int)$nchunks));
$nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1;
list($lcs, $seps)
= $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks);
list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks);
}
if ($lcs == 0) {
@ -344,7 +343,7 @@ class DiffEngine {
$i = 0;
$j = 0;
$this::USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
$this::USE_ASSERTS && assert(sizeof($lines) == sizeof($changed));
$len = sizeof($lines);
$other_len = sizeof($other_changed);
@ -364,7 +363,7 @@ class DiffEngine {
$j++;
}
while ($i < $len && !$changed[$i]) {
$this::USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$this::USE_ASSERTS && assert($j < $other_len && ! $other_changed[$j]);
$i++;
$j++;
while ($j < $other_len && $other_changed[$j]) {
@ -400,11 +399,11 @@ class DiffEngine {
while ($start > 0 && $changed[$start - 1]) {
$start--;
}
$this::USE_ASSERTS && assert('$j > 0');
$this::USE_ASSERTS && assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
$this::USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
$this::USE_ASSERTS && assert($j >= 0 && !$other_changed[$j]);
}
/*
@ -427,7 +426,7 @@ class DiffEngine {
while ($i < $len && $changed[$i]) {
$i++;
}
$this::USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
$this::USE_ASSERTS && assert($j < $other_len && ! $other_changed[$j]);
$j++;
if ($j < $other_len && $other_changed[$j]) {
$corresponding = $i;
@ -445,11 +444,11 @@ class DiffEngine {
while ($corresponding < $i) {
$changed[--$start] = 1;
$changed[--$i] = 0;
$this::USE_ASSERTS && assert('$j > 0');
$this::USE_ASSERTS && assert($j > 0);
while ($other_changed[--$j]) {
continue;
}
$this::USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
$this::USE_ASSERTS && assert($j >= 0 && !$other_changed[$j]);
}
}
}

View file

@ -2,8 +2,6 @@
namespace Drupal\Component\Diff\Engine;
use Drupal\Component\Utility\Unicode;
/**
* Additions by Axel Boldt follow, partly taken from diff.php, phpwiki-1.3.3
*/
@ -64,7 +62,7 @@ class HWLDFWordAccumulator {
}
if ($word[0] == "\n") {
$this->_flushLine($tag);
$word = Unicode::substr($word, 1);
$word = mb_substr($word, 1);
}
assert(!strstr($word, "\n"));
$this->group .= $word;

View file

@ -19,16 +19,17 @@ class MappedDiff extends Diff {
* case-insensitive diffs, or diffs which ignore
* changes in white-space.
*
* @param $from_lines array An array of strings.
* @param array $from_lines
* An array of strings.
* (Typically these are lines from a file.)
* @param $to_lines array An array of strings.
* @param $mapped_from_lines array This array should
* have the same size number of elements as $from_lines.
* The elements in $mapped_from_lines and
* $mapped_to_lines are what is actually compared
* when computing the diff.
* @param $mapped_to_lines array This array should
* have the same number of elements as $to_lines.
* @param array $to_lines
* An array of strings.
* @param array $mapped_from_lines
* This array should have the same size number of elements as $from_lines.
* The elements in $mapped_from_lines and $mapped_to_lines are what is
* actually compared when computing the diff.
* @param array $mapped_to_lines
* This array should have the same number of elements as $to_lines.
*/
public function __construct($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {

View file

@ -3,7 +3,6 @@
namespace Drupal\Component\Diff;
use Drupal\Component\Diff\Engine\HWLDFWordAccumulator;
use Drupal\Component\Utility\Unicode;
/**
* @todo document
@ -35,7 +34,7 @@ class WordLevelDiff extends MappedDiff {
$words[] = "\n";
$stripped[] = "\n";
}
if (Unicode::strlen($line) > $this::MAX_LINE_LENGTH) {
if (mb_strlen($line) > $this::MAX_LINE_LENGTH) {
$words[] = $line;
$stripped[] = $line;
}

View file

@ -3,10 +3,10 @@
"description": "Diff.",
"keywords": ["drupal"],
"homepage": "https://www.drupal.org/project/drupal",
"license": "GPL-2.0+",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=5.5.9",
"drupal/utility": "~8.2"
"symfony/polyfill-mbstring": "~1.0"
},
"autoload": {
"psr-4": {