Skip to content

Commit 173b980

Browse files
committed
Merge branch '5.2' into 5.3
* 5.2: Simplify some code with null coalesce operator Don't use deprecated TestLogger class
2 parents 5c1fbd6 + 3fdeaf3 commit 173b980

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ public function getRequestFormat(?string $default = 'html')
13861386
$this->format = $this->attributes->get('_format');
13871387
}
13881388

1389-
return null === $this->format ? $default : $this->format;
1389+
return $this->format ?? $default;
13901390
}
13911391

13921392
/**

RequestStack.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ public function getParentRequest()
109109
{
110110
$pos = \count($this->requests) - 2;
111111

112-
if (!isset($this->requests[$pos])) {
113-
return null;
114-
}
115-
116-
return $this->requests[$pos];
112+
return $this->requests[$pos] ?? null;
117113
}
118114

119115
/**

ResponseHeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function hasCacheControlDirective(string $key)
174174
*/
175175
public function getCacheControlDirective(string $key)
176176
{
177-
return \array_key_exists($key, $this->computedCacheControl) ? $this->computedCacheControl[$key] : null;
177+
return $this->computedCacheControl[$key] ?? null;
178178
}
179179

180180
public function setCookie(Cookie $cookie)

Session/Storage/MetadataBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ private function stampCreated(int $lifetime = null): void
161161
{
162162
$timeStamp = time();
163163
$this->meta[self::CREATED] = $this->meta[self::UPDATED] = $this->lastUsed = $timeStamp;
164-
$this->meta[self::LIFETIME] = (null === $lifetime) ? ini_get('session.cookie_lifetime') : $lifetime;
164+
$this->meta[self::LIFETIME] = $lifetime ?? ini_get('session.cookie_lifetime');
165165
}
166166
}

0 commit comments

Comments
 (0)