Skip to content

Commit 3954a2b

Browse files
committed
Fix probably undefined variable
1 parent 94c8bd5 commit 3954a2b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Diff for: lib/jblond/Diff/Renderer/Text/InlineCli.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ private function mergeChanges(
210210
foreach ($baselineParts as $partKey => &$part) {
211211
if ($iterator++ % 2) {
212212
// This part of the line has been changed. Surround it with user defined markers.
213-
$basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1];
213+
$basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1];
214+
$changedPart = '';
214215
if (isset($changedLineParts[$partKey])) {
215216
$changedPart =
216217
$this->options['insertMarkers'][0] .
@@ -219,13 +220,13 @@ private function mergeChanges(
219220
}
220221

221222
if ($this->options['cliColor']) {
222-
// Colorize the changed part.
223-
[$fgColor, $bgColor] = $deleteColors;
224-
$basePart = $colorize->getColoredString($basePart, $fgColor, $bgColor);
225-
[$fgColor, $bgColor] = $insertColors;
226-
$changedPart = $colorize->getColoredString($changedPart, $fgColor, $bgColor); // FIXME
223+
// Colorize the changed part. $colorize is defined above.
224+
$basePart = $colorize->getColoredString($basePart, ...$deleteColors);
225+
if (!empty($changedPart)) {
226+
$changedPart = $colorize->getColoredString($changedPart, ...$insertColors);
227+
}
227228
}
228-
$part = $basePart . $changedPart; // FIXME
229+
$part = $basePart . $changedPart;
229230
}
230231
}
231232
unset($part);

0 commit comments

Comments
 (0)