Skip to content

Commit 5a443a9

Browse files
javiereguiluzderrabus
authored andcommitted
Simplify some code with null coalesce operator
1 parent bbfcb4d commit 5a443a9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Dumper/AbstractDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __construct($output = null, string $charset = null, int $flags =
6363
*/
6464
public function setOutput($output)
6565
{
66-
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
66+
$prev = $this->outputStream ?? $this->lineDumper;
6767

6868
if (\is_callable($output)) {
6969
$this->outputStream = null;

Dumper/HtmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function dump(Data $data, $output = null, array $extraDisplayOptions = []
153153
*/
154154
protected function getDumpHeader()
155155
{
156-
$this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
156+
$this->headerIsDumped = $this->outputStream ?? $this->lineDumper;
157157

158158
if (null !== $this->dumpHeader) {
159159
return $this->dumpHeader;
@@ -964,7 +964,7 @@ protected function dumpLine($depth, $endOfValue = false)
964964
if (-1 === $this->lastDepth) {
965965
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
966966
}
967-
if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
967+
if ($this->headerIsDumped !== ($this->outputStream ?? $this->lineDumper)) {
968968
$this->line = $this->getDumpHeader().$this->line;
969969
}
970970

0 commit comments

Comments
 (0)