Skip to content

Commit 10049e1

Browse files
SpacePossumsebastianbergmann
authored andcommitted
Cast before construction of Chunk
1 parent 4f5e0bc commit 10049e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Parser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function parse($string)
2424
{
2525
$lines = \preg_split('(\r\n|\r|\n)', $string);
2626

27-
if (!empty($lines) && $lines[\count($lines) - 1] == '') {
27+
if (!empty($lines) && $lines[\count($lines) - 1] === '') {
2828
\array_pop($lines);
2929
}
3030

@@ -76,10 +76,10 @@ private function parseFileDiff(Diff $diff, array $lines)
7676
foreach ($lines as $line) {
7777
if (\preg_match('/^@@\s+-(?P<start>\d+)(?:,\s*(?P<startrange>\d+))?\s+\+(?P<end>\d+)(?:,\s*(?P<endrange>\d+))?\s+@@/', $line, $match)) {
7878
$chunk = new Chunk(
79-
$match['start'],
80-
isset($match['startrange']) ? \max(1, $match['startrange']) : 1,
81-
$match['end'],
82-
isset($match['endrange']) ? \max(1, $match['endrange']) : 1
79+
(int) $match['start'],
80+
isset($match['startrange']) ? \max(1, (int) $match['startrange']) : 1,
81+
(int) $match['end'],
82+
isset($match['endrange']) ? \max(1, (int) $match['endrange']) : 1
8383
);
8484

8585
$chunks[] = $chunk;

0 commit comments

Comments
 (0)