Skip to content

Commit de32cc0

Browse files
authored
Set default range counts (#211)
* Set default range counts * Force ints
1 parent a8bfcd1 commit de32cc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Gitonomy/Git/Parser/DiffParser.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ protected function doParse()
102102
while ($this->expects('@@ ')) {
103103
$vars = $this->consumeRegexp('/-(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))?/');
104104
$rangeOldStart = (int) $vars[1];
105-
$rangeOldCount = (int) $vars[2];
105+
$rangeOldCount = (int) ($vars[2] ?? 1);
106106
$rangeNewStart = (int) $vars[3];
107-
$rangeNewCount = isset($vars[4]) ? (int) $vars[4] : (int) $vars[2]; // @todo Ici, t'as pris un gros raccourci mon loulou
107+
$rangeNewCount = (int) ($vars[4] ?? 1);
108108
$this->consume(' @@');
109109
$this->consumeTo("\n");
110110
$this->consumeNewLine();

0 commit comments

Comments
 (0)