Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit cd19bf8

Browse files
periodic1236facebook-github-bot
authored andcommitted
use ??= (1/?)
Summary: Generated with {D10356459} Reviewed By: viratyosin Differential Revision: D10325207 fbshipit-source-id: d057835200bdbcc0035ccff6d8ca42b95b385b7c
1 parent 9ed97da commit cd19bf8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/StringDiff.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function getUnifiedDiff(int $context = 3): string {
5858
$run_start = null;
5959
for ($i = $context; $i < $count; ++$i) {
6060
if ($remaining[$i] instanceof DiffKeepOp) {
61-
$run_start = $run_start ?? $i;
61+
$run_start ??= $i;
6262
continue;
6363
}
6464

@@ -99,25 +99,25 @@ private function getUnifiedDiffHunk(
9999
foreach ($hunk as $op) {
100100
if ($op instanceof DiffKeepOp) {
101101
$lines[] = ' '.$op->getContent();
102-
$old_start = $old_start ?? $op->getOldPos();
103-
$new_start = $new_start ?? $op->getNewPos();
102+
$old_start ??= $op->getOldPos();
103+
$new_start ??= $op->getNewPos();
104104
++$old_lines;
105105
++$new_lines;
106106
continue;
107107
}
108108

109109
if ($op instanceof DiffDeleteOp) {
110110
$lines[] = '-'.$op->getContent();
111-
$old_start = $old_start ?? $op->getOldPos();
112-
$new_start = $new_start ?? $op->getOldPos();
111+
$old_start ??= $op->getOldPos();
112+
$new_start ??= $op->getOldPos();
113113
++$old_lines;
114114
continue;
115115
}
116116

117117
if ($op instanceof DiffInsertOp) {
118118
$lines[] = '+'.$op->getContent();
119-
$old_start = $old_start ?? $op->getNewPos();
120-
$new_start = $new_start ?? $op->getNewPos();
119+
$old_start ??= $op->getNewPos();
120+
$new_start ??= $op->getNewPos();
121121
++$new_lines;
122122
continue;
123123
}

0 commit comments

Comments
 (0)