Skip to content

Commit 98398d0

Browse files
Add more nullsafe operators
1 parent 2ad9fab commit 98398d0

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Session/Session.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function __construct(SessionStorageInterface $storage = null, AttributeBa
4545
$this->storage = $storage ?? new NativeSessionStorage();
4646
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
4747

48-
$attributes = $attributes ?? new AttributeBag();
48+
$attributes ??= new AttributeBag();
4949
$this->attributeName = $attributes->getName();
5050
$this->registerBag($attributes);
5151

52-
$flashes = $flashes ?? new FlashBag();
52+
$flashes ??= new FlashBag();
5353
$this->flashName = $flashes->getName();
5454
$this->registerBag($flashes);
5555
}

Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ private function buildDsnFromUrl(string $dsnOrUrl): string
454454
// If "unix_socket" is not in the query, we continue with the same process as pgsql
455455
// no break
456456
case 'pgsql':
457-
$dsn ?? $dsn = 'pgsql:';
457+
$dsn ??= 'pgsql:';
458458

459459
if (isset($params['host']) && '' !== $params['host']) {
460460
$dsn .= 'host='.$params['host'].';';

Session/Storage/NativeSessionStorageFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(array $options = [], AbstractProxy|\SessionHandlerIn
4141
public function createStorage(?Request $request): SessionStorageInterface
4242
{
4343
$storage = new NativeSessionStorage($this->options, $this->handler, $this->metaBag);
44-
if ($this->secure && $request && $request->isSecure()) {
44+
if ($this->secure && $request?->isSecure()) {
4545
$storage->setOptions(['cookie_secure' => true]);
4646
}
4747

Session/Storage/PhpBridgeSessionStorageFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(AbstractProxy|\SessionHandlerInterface $handler = nu
3636
public function createStorage(?Request $request): SessionStorageInterface
3737
{
3838
$storage = new PhpBridgeSessionStorage($this->handler, $this->metaBag);
39-
if ($this->secure && $request && $request->isSecure()) {
39+
if ($this->secure && $request?->isSecure()) {
4040
$storage->setOptions(['cookie_secure' => true]);
4141
}
4242

0 commit comments

Comments
 (0)