Skip to content

Commit

Permalink
Ternary to null coalescing
Browse files Browse the repository at this point in the history
Use null coalescing operator ?? where possible.

Closes GH-528.
  • Loading branch information
MathiasReker authored Jun 17, 2022
1 parent 89ac76c commit ede0cad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eol.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</a>
</td>
<td>
<?php echo isset($BRANCH_NOTES[$branch]) ? $BRANCH_NOTES[$branch] : ''; ?>
<?php echo $BRANCH_NOTES[$branch] ?? ''; ?>
</td>
</tr>
<?php endforeach ?>
Expand Down
5 changes: 2 additions & 3 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@
// No error was found, and the submit action is required
if (!$error && strtolower($_POST['action']) != "preview") {

$redirip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
$_SERVER['HTTP_X_FORWARDED_FOR'] :
(isset($_SERVER['HTTP_VIA']) ? $_SERVER['HTTP_VIA'] : '');
$redirip = $_SERVER['HTTP_X_FORWARDED_FOR'] ??
($_SERVER['HTTP_VIA'] ?? '');

// Post the variables to the central user note script
$result = posttohost(
Expand Down
4 changes: 2 additions & 2 deletions manual/vote-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
$error = false;
$thankyou = false;
$headerset = false;
$BACKpage = htmlspecialchars(isset($_REQUEST['page']) ? $_REQUEST['page'] : '');
$BACKid = htmlspecialchars(isset($_REQUEST['id']) ? $_REQUEST['id'] : '');
$BACKpage = htmlspecialchars($_REQUEST['page'] ?? '');
$BACKid = htmlspecialchars($_REQUEST['id'] ?? '');
$link = "/{$BACKpage}#{$BACKid}";
$master_url = "https://main.php.net/entry/user-notes-vote.php";

Expand Down

0 comments on commit ede0cad

Please sign in to comment.