Skip to content

Commit

Permalink
Avoid unintentional conversion of index to boolean (#208)
Browse files Browse the repository at this point in the history
Avoid unintentional conversion of index to boolean.
  • Loading branch information
codebymikey authored Nov 3, 2024
1 parent 5fa8b85 commit d1c05fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Gitonomy/Git/Parser/DiffParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ protected function doParse()
$oldName = $oldName === '/dev/null' ? null : substr($oldName, 2);
$newName = $newName === '/dev/null' ? null : substr($newName, 2);

$oldIndex = $oldIndex !== null ?: '';
$newIndex = $newIndex !== null ?: '';
$oldIndex = $oldIndex === null ? '' : $oldIndex;
$newIndex = $newIndex === null ? '' : $newIndex;
$oldIndex = preg_match('/^0+$/', $oldIndex) ? null : $oldIndex;
$newIndex = preg_match('/^0+$/', $newIndex) ? null : $newIndex;
$file = new File($oldName, $newName, $oldMode, $newMode, $oldIndex, $newIndex, $isBinary);
Expand Down

0 comments on commit d1c05fd

Please sign in to comment.