Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -49,7 +49,7 @@ class Diff {
|
|||
*/
|
||||
public function reverse() {
|
||||
$rev = $this;
|
||||
$rev->edits = array();
|
||||
$rev->edits = [];
|
||||
foreach ($this->edits as $edit) {
|
||||
$rev->edits[] = $edit->reverse();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class Diff {
|
|||
* @return array The original sequence of strings.
|
||||
*/
|
||||
public function orig() {
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->orig) {
|
||||
|
@ -115,7 +115,7 @@ class Diff {
|
|||
* @return array The sequence of strings.
|
||||
*/
|
||||
public function closing() {
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->closing) {
|
||||
|
|
|
@ -41,10 +41,10 @@ class DiffFormatter {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $line_stats = array(
|
||||
'counter' => array('x' => 0, 'y' => 0),
|
||||
'offset' => array('x' => 0, 'y' => 0),
|
||||
);
|
||||
protected $line_stats = [
|
||||
'counter' => ['x' => 0, 'y' => 0],
|
||||
'offset' => ['x' => 0, 'y' => 0],
|
||||
];
|
||||
|
||||
/**
|
||||
* Format a diff.
|
||||
|
@ -58,7 +58,7 @@ class DiffFormatter {
|
|||
public function format(Diff $diff) {
|
||||
$xi = $yi = 1;
|
||||
$block = FALSE;
|
||||
$context = array();
|
||||
$context = [];
|
||||
|
||||
$nlead = $this->leading_context_lines;
|
||||
$ntrail = $this->trailing_context_lines;
|
||||
|
@ -87,7 +87,7 @@ class DiffFormatter {
|
|||
$context = array_slice($context, sizeof($context) - $nlead);
|
||||
$x0 = $xi - sizeof($context);
|
||||
$y0 = $yi - sizeof($context);
|
||||
$block = array();
|
||||
$block = [];
|
||||
if ($context) {
|
||||
$block[] = new DiffOpCopy($context);
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ class DiffEngine {
|
|||
$n_from = sizeof($from_lines);
|
||||
$n_to = sizeof($to_lines);
|
||||
|
||||
$this->xchanged = $this->ychanged = array();
|
||||
$this->xv = $this->yv = array();
|
||||
$this->xind = $this->yind = array();
|
||||
$this->xchanged = $this->ychanged = [];
|
||||
$this->xv = $this->yv = [];
|
||||
$this->xind = $this->yind = [];
|
||||
unset($this->seq);
|
||||
unset($this->in_seq);
|
||||
unset($this->lcs);
|
||||
|
@ -93,14 +93,14 @@ class DiffEngine {
|
|||
$this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged);
|
||||
|
||||
// Compute the edit operations.
|
||||
$edits = array();
|
||||
$edits = [];
|
||||
$xi = $yi = 0;
|
||||
while ($xi < $n_from || $yi < $n_to) {
|
||||
$this::USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
|
||||
$this::USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
|
||||
|
||||
// Skip matching "snake".
|
||||
$copy = array();
|
||||
$copy = [];
|
||||
while ( $xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
|
||||
$copy[] = $from_lines[$xi++];
|
||||
++$yi;
|
||||
|
@ -109,11 +109,11 @@ class DiffEngine {
|
|||
$edits[] = new DiffOpCopy($copy);
|
||||
}
|
||||
// Find deletes & adds.
|
||||
$delete = array();
|
||||
$delete = [];
|
||||
while ($xi < $n_from && $this->xchanged[$xi]) {
|
||||
$delete[] = $from_lines[$xi++];
|
||||
}
|
||||
$add = array();
|
||||
$add = [];
|
||||
while ($yi < $n_to && $this->ychanged[$yi]) {
|
||||
$add[] = $to_lines[$yi++];
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ class DiffEngine {
|
|||
// Things seems faster (I'm not sure I understand why)
|
||||
// when the shortest sequence in X.
|
||||
$flip = TRUE;
|
||||
list($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim);
|
||||
list($xoff, $xlim, $yoff, $ylim) = [$yoff, $ylim, $xoff, $xlim];
|
||||
}
|
||||
|
||||
if ($flip) {
|
||||
|
@ -182,8 +182,8 @@ class DiffEngine {
|
|||
}
|
||||
$this->lcs = 0;
|
||||
$this->seq[0] = $yoff - 1;
|
||||
$this->in_seq = array();
|
||||
$ymids[0] = array();
|
||||
$this->in_seq = [];
|
||||
$ymids[0] = [];
|
||||
|
||||
$numer = $xlim - $xoff + $nchunks - 1;
|
||||
$x = $xoff;
|
||||
|
@ -228,16 +228,16 @@ class DiffEngine {
|
|||
}
|
||||
}
|
||||
|
||||
$seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff);
|
||||
$seps[] = $flip ? [$yoff, $xoff] : [$xoff, $yoff];
|
||||
$ymid = $ymids[$this->lcs];
|
||||
for ($n = 0; $n < $nchunks - 1; $n++) {
|
||||
$x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks);
|
||||
$y1 = $ymid[$n] + 1;
|
||||
$seps[] = $flip ? array($y1, $x1) : array($x1, $y1);
|
||||
$seps[] = $flip ? [$y1, $x1] : [$x1, $y1];
|
||||
}
|
||||
$seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim);
|
||||
$seps[] = $flip ? [$ylim, $xlim] : [$xlim, $ylim];
|
||||
|
||||
return array($this->lcs, $seps);
|
||||
return [$this->lcs, $seps];
|
||||
}
|
||||
|
||||
protected function _lcs_pos($ypos) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class HWLDFWordAccumulator {
|
|||
*/
|
||||
const NBSP = ' ';
|
||||
|
||||
protected $lines = array();
|
||||
protected $lines = [];
|
||||
|
||||
protected $line = '';
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class WordLevelDiff extends MappedDiff {
|
|||
}
|
||||
|
||||
protected function _split($lines) {
|
||||
$words = array();
|
||||
$stripped = array();
|
||||
$words = [];
|
||||
$stripped = [];
|
||||
$first = TRUE;
|
||||
foreach ($lines as $line) {
|
||||
// If the line is too long, just pretend the entire line is one big word
|
||||
|
@ -46,7 +46,7 @@ class WordLevelDiff extends MappedDiff {
|
|||
}
|
||||
}
|
||||
}
|
||||
return array($words, $stripped);
|
||||
return [$words, $stripped];
|
||||
}
|
||||
|
||||
public function orig() {
|
||||
|
|
Reference in a new issue