Skip to content

Commit 0b693cf

Browse files
javiereguiluzderrabus
authored andcommitted
Simplify some code with null coalesce operator
1 parent 9da2a51 commit 0b693cf

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

EventListener/DebugHandlersListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
6060

6161
$this->exceptionHandler = $exceptionHandler;
6262
$this->logger = $logger;
63-
$this->levels = null === $levels ? \E_ALL : $levels;
63+
$this->levels = $levels ?? \E_ALL;
6464
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
6565
$this->scream = $scream;
6666
$this->fileLinkFormat = $fileLinkFormat;

Profiler/Profile.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,7 @@ public function setUrl($url)
156156
*/
157157
public function getTime()
158158
{
159-
if (null === $this->time) {
160-
return 0;
161-
}
162-
163-
return $this->time;
159+
return $this->time ?? 0;
164160
}
165161

166162
/**

Tests/KernelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu
709709
$bundle
710710
->expects($this->any())
711711
->method('getName')
712-
->willReturn(null === $bundleName ? \get_class($bundle) : $bundleName)
712+
->willReturn($bundleName ?? \get_class($bundle))
713713
;
714714

715715
$bundle

0 commit comments

Comments
 (0)