Skip to content

Commit 2455a11

Browse files
committed
CS: Apply ternary_to_null_coalescing fixer
1 parent f953fa4 commit 2455a11

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

DataCollector/ConfigDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function getPhpVersion()
219219
*/
220220
public function getPhpVersionExtra()
221221
{
222-
return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
222+
return $this->data['php_version_extra'] ?? null;
223223
}
224224

225225
/**

DataCollector/LoggerDataCollector.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,32 @@ public function lateCollect()
8181

8282
public function getLogs()
8383
{
84-
return isset($this->data['logs']) ? $this->data['logs'] : [];
84+
return $this->data['logs'] ?? [];
8585
}
8686

8787
public function getPriorities()
8888
{
89-
return isset($this->data['priorities']) ? $this->data['priorities'] : [];
89+
return $this->data['priorities'] ?? [];
9090
}
9191

9292
public function countErrors()
9393
{
94-
return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
94+
return $this->data['error_count'] ?? 0;
9595
}
9696

9797
public function countDeprecations()
9898
{
99-
return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;
99+
return $this->data['deprecation_count'] ?? 0;
100100
}
101101

102102
public function countWarnings()
103103
{
104-
return isset($this->data['warning_count']) ? $this->data['warning_count'] : 0;
104+
return $this->data['warning_count'] ?? 0;
105105
}
106106

107107
public function countScreams()
108108
{
109-
return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0;
109+
return $this->data['scream_count'] ?? 0;
110110
}
111111

112112
public function getCompilerLogs()

DataCollector/RequestDataCollector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function collect(Request $request, Response $response/*, \Throwable $exce
8888
'format' => $request->getRequestFormat(),
8989
'content' => $content,
9090
'content_type' => $response->headers->get('Content-Type', 'text/html'),
91-
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
91+
'status_text' => Response::$statusTexts[$statusCode] ?? '',
9292
'status_code' => $statusCode,
9393
'request_query' => $request->query->all(),
9494
'request_request' => $request->request->all(),
@@ -339,12 +339,12 @@ public function getController()
339339
*/
340340
public function getRedirect()
341341
{
342-
return isset($this->data['redirect']) ? $this->data['redirect'] : false;
342+
return $this->data['redirect'] ?? false;
343343
}
344344

345345
public function getForwardToken()
346346
{
347-
return isset($this->data['forward_token']) ? $this->data['forward_token'] : null;
347+
return $this->data['forward_token'] ?? null;
348348
}
349349

350350
/**

EventListener/RouterListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function onKernelRequest(GetResponseEvent $event)
116116

117117
if (null !== $this->logger) {
118118
$this->logger->info('Matched route "{route}".', [
119-
'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a',
119+
'route' => $parameters['_route'] ?? 'n/a',
120120
'route_parameters' => $parameters,
121121
'request_uri' => $request->getUri(),
122122
'method' => $request->getMethod(),

Fragment/AbstractSurrogateFragmentRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ public function render($uri, Request $request, array $options = [])
7171
$uri = $this->generateSignedFragmentUri($uri, $request);
7272
}
7373

74-
$alt = isset($options['alt']) ? $options['alt'] : null;
74+
$alt = $options['alt'] ?? null;
7575
if ($alt instanceof ControllerReference) {
7676
$alt = $this->generateSignedFragmentUri($alt, $request);
7777
}
7878

79-
$tag = $this->surrogate->renderIncludeTag($uri, $alt, isset($options['ignore_errors']) ? $options['ignore_errors'] : false, isset($options['comment']) ? $options['comment'] : '');
79+
$tag = $this->surrogate->renderIncludeTag($uri, $alt, $options['ignore_errors'] ?? false, $options['comment'] ?? '');
8080

8181
return new Response($tag);
8282
}

Fragment/HIncludeFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function render($uri, Request $request, array $options = [])
100100
// We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content.
101101
$uri = str_replace('&', '&', $uri);
102102

103-
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
103+
$template = $options['default'] ?? $this->globalDefaultTemplate;
104104
if (null !== $this->templating && $template && $this->templateExists($template)) {
105105
$content = $this->templating->render($template);
106106
} else {

HttpCache/Esi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function process(Request $request, Response $response)
9797

9898
$chunks[$i] = sprintf('<?php echo $this->surrogate->handle($this, %s, %s, %s) ?>'."\n",
9999
var_export($options['src'], true),
100-
var_export(isset($options['alt']) ? $options['alt'] : '', true),
100+
var_export($options['alt'] ?? '', true),
101101
isset($options['onerror']) && 'continue' === $options['onerror'] ? 'true' : 'false'
102102
);
103103
++$i;

HttpCache/Store.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ private function requestsMatch(?string $vary, array $env1, array $env2): bool
277277

278278
foreach (preg_split('/[\s,]+/', $vary) as $header) {
279279
$key = str_replace('_', '-', strtolower($header));
280-
$v1 = isset($env1[$key]) ? $env1[$key] : null;
281-
$v2 = isset($env2[$key]) ? $env2[$key] : null;
280+
$v1 = $env1[$key] ?? null;
281+
$v2 = $env2[$key] ?? null;
282282
if ($v1 !== $v2) {
283283
return false;
284284
}

Log/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(string $minLevel = null, $output = null, callable $f
4343
$minLevel = null === $output || 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::ERROR : LogLevel::WARNING;
4444

4545
if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) {
46-
switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) {
46+
switch ((int) ($_ENV['SHELL_VERBOSITY'] ?? $_SERVER['SHELL_VERBOSITY'])) {
4747
case -1: $minLevel = LogLevel::ERROR; break;
4848
case 1: $minLevel = LogLevel::NOTICE; break;
4949
case 2: $minLevel = LogLevel::INFO; break;

UriSigner.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ private function buildUrl(array $url, array $params = []): string
9393
$url['query'] = http_build_query($params, '', '&');
9494

9595
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
96-
$host = isset($url['host']) ? $url['host'] : '';
96+
$host = $url['host'] ?? '';
9797
$port = isset($url['port']) ? ':'.$url['port'] : '';
98-
$user = isset($url['user']) ? $url['user'] : '';
98+
$user = $url['user'] ?? '';
9999
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
100100
$pass = ($user || $pass) ? "$pass@" : '';
101-
$path = isset($url['path']) ? $url['path'] : '';
101+
$path = $url['path'] ?? '';
102102
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
103103
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';
104104

0 commit comments

Comments
 (0)