Skip to content

Commit 7287933

Browse files
Petr Koteklazyfrosch
authored andcommitted
vendor: Update php-diff with fixes
Version is based on: * chrisboulton/php-diff@3cb3f7c * and chrisboulton/php-diff#50 Also see SOURCE
1 parent 8e28f7f commit 7287933

File tree

4 files changed

+24
-20
lines changed

4 files changed

+24
-20
lines changed

library/vendor/php-diff/SOURCE

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# version based on current master 3cb3f7ce6bb8b910f5a41ea1887b1faceba6a7d7
6+
# plus https://github.com/chrisboulton/php-diff/pull/50
17
git clone https://github.com/chrisboulton/php-diff.git
2-
# Last used commit:
8+
39
cd php-diff
4-
git checkout f4db229d7ae8dffa0a4f90e1adbec9bf22c93d99
10+
11+
git fetch origin pull/50/head:pr
12+
git checkout a9f124f81a9436138879e56157c6cced52a6d95b
13+
git show -s
14+
515
rm -rf .git
616
rm -rf .gitignore
717
rm -rf composer.json
8-
rm -rf example
18+
rm -rf example tests phpunit.xml
919
cd ..

library/vendor/php-diff/lib/Diff/Renderer/Html/Array.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,21 @@ protected function formatLines($lines)
176176
{
177177
$lines = array_map(array($this, 'ExpandTabs'), $lines);
178178
$lines = array_map(array($this, 'HtmlSafe'), $lines);
179-
$callback = array($this, 'fixMatchedSpaces');
180179
foreach($lines as &$line) {
181-
// $line = preg_replace('# ( +)|^ #e', "\$this->fixSpaces('\\1')", $line);
182-
$line = preg_replace_callback('# ( +)|^ #', $callback, $line);
180+
$line = preg_replace_callback('# ( +)|^ #', array($this, 'fixSpaces'), $line);
183181
}
184182
return $lines;
185183
}
186184

187-
protected function fixMatchedSpaces($m)
188-
{
189-
return $this->fixSpaces($m[1]);
190-
}
191-
192185
/**
193186
* Replace a string containing spaces with a HTML representation using  .
194187
*
195-
* @param string $spaces The string of spaces.
188+
* @param string[] $matches Array with preg matches.
196189
* @return string The HTML representation of the string.
197190
*/
198-
function fixSpaces($spaces='')
191+
private function fixSpaces(array $matches)
199192
{
193+
$spaces = $matches[1];
200194
$count = strlen($spaces);
201195
if($count == 0) {
202196
return '';

library/vendor/php-diff/lib/Diff/Renderer/Html/Inline.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public function render()
128128
foreach($change['changed']['lines'] as $no => $line) {
129129
$toLine = $change['changed']['offset'] + $no + 1;
130130
$html .= '<tr>';
131-
$html .= '<th>'.$toLine.'</th>';
132131
$html .= '<th>&nbsp;</th>';
132+
$html .= '<th>'.$toLine.'</th>';
133133
$html .= '<td class="Right"><span>'.$line.'</span></td>';
134134
$html .= '</tr>';
135135
}
@@ -140,4 +140,4 @@ public function render()
140140
$html .= '</table>';
141141
return $html;
142142
}
143-
}
143+
}

library/vendor/php-diff/lib/Diff/SequenceMatcher.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class Diff_SequenceMatcher
5050
/**
5151
* @var array The first sequence to compare against.
5252
*/
53-
private $a = null;
53+
private $a = array();
5454

5555
/**
5656
* @var array The second sequence.
5757
*/
58-
private $b = null;
58+
private $b = array();
5959

6060
/**
6161
* @var array Array of characters that are considered junk from the second sequence. Characters are the array key.
@@ -86,8 +86,8 @@ class Diff_SequenceMatcher
8686
*/
8787
public function __construct($a, $b, $junkCallback=null, $options)
8888
{
89-
$this->a = null;
90-
$this->b = null;
89+
$this->a = array();
90+
$this->b = array();
9191
$this->junkCallback = $junkCallback;
9292
$this->setOptions($options);
9393
$this->setSequences($a, $b);
@@ -739,4 +739,4 @@ private function tupleSort($a, $b)
739739
return 1;
740740
}
741741
}
742-
}
742+
}

0 commit comments

Comments
 (0)