Skip to content

Commit

Permalink
using ?? operator (Null Coalescing Operator) (#51305)
Browse files Browse the repository at this point in the history
  • Loading branch information
saMahmoudzadeh authored May 6, 2024
1 parent 7161dff commit dbcad29
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/Illuminate/Foundation/Configuration/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,7 @@ public function getGlobalMiddleware()
]));

$middleware = array_map(function ($middleware) {
return isset($this->replacements[$middleware])
? $this->replacements[$middleware]
: $middleware;
return $this->replacements[$middleware] ?? $middleware;
}, $middleware);

return array_values(array_filter(
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Process/FakeInvokedProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public function latestOutput()
$this->nextOutputIndex = $i + 1;
}

return isset($output) ? $output : '';
return $output ?? '';
}

/**
Expand All @@ -249,7 +249,7 @@ public function latestErrorOutput()
$this->nextErrorOutputIndex = $i + 1;
}

return isset($output) ? $output : '';
return $output ?? '';
}

/**
Expand Down
6 changes: 1 addition & 5 deletions src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,7 @@ protected function shouldDispatchAfterCommit($job)
return $job->afterCommit;
}

if (isset($this->dispatchAfterCommit)) {
return $this->dispatchAfterCommit;
}

return false;
return $this->dispatchAfterCommit ?? false;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Testing/Concerns/RunsInParallel.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ public function execute(): int
});
}

return $potentialExitCode === null
? $this->getExitCode()
: $potentialExitCode;
return $potentialExitCode ?? $this->getExitCode();
}

/**
Expand Down

0 comments on commit dbcad29

Please sign in to comment.