Skip to content

Commit c5e68b1

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: CS: Apply ternary_to_null_coalescing fixer
2 parents 934ac27 + b900f53 commit c5e68b1

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

Loader/YamlFileLoader.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ public function supports($resource, string $type = null)
113113
*/
114114
protected function parseRoute(RouteCollection $collection, string $name, array $config, string $path)
115115
{
116-
$defaults = isset($config['defaults']) ? $config['defaults'] : [];
117-
$requirements = isset($config['requirements']) ? $config['requirements'] : [];
118-
$options = isset($config['options']) ? $config['options'] : [];
116+
$defaults = $config['defaults'] ?? [];
117+
$requirements = $config['requirements'] ?? [];
118+
$options = $config['options'] ?? [];
119119

120120
foreach ($requirements as $placeholder => $requirement) {
121121
if (\is_int($placeholder)) {
@@ -161,15 +161,15 @@ protected function parseRoute(RouteCollection $collection, string $name, array $
161161
*/
162162
protected function parseImport(RouteCollection $collection, array $config, string $path, string $file)
163163
{
164-
$type = isset($config['type']) ? $config['type'] : null;
165-
$prefix = isset($config['prefix']) ? $config['prefix'] : '';
166-
$defaults = isset($config['defaults']) ? $config['defaults'] : [];
167-
$requirements = isset($config['requirements']) ? $config['requirements'] : [];
168-
$options = isset($config['options']) ? $config['options'] : [];
169-
$host = isset($config['host']) ? $config['host'] : null;
170-
$condition = isset($config['condition']) ? $config['condition'] : null;
171-
$schemes = isset($config['schemes']) ? $config['schemes'] : null;
172-
$methods = isset($config['methods']) ? $config['methods'] : null;
164+
$type = $config['type'] ?? null;
165+
$prefix = $config['prefix'] ?? '';
166+
$defaults = $config['defaults'] ?? [];
167+
$requirements = $config['requirements'] ?? [];
168+
$options = $config['options'] ?? [];
169+
$host = $config['host'] ?? null;
170+
$condition = $config['condition'] ?? null;
171+
$schemes = $config['schemes'] ?? null;
172+
$methods = $config['methods'] ?? null;
173173
$trailingSlashOnRoot = $config['trailing_slash_on_root'] ?? true;
174174
$namePrefix = $config['name_prefix'] ?? null;
175175
$exclude = $config['exclude'] ?? null;

Matcher/TraceableUrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes)
146146

147147
$this->addTrace('Route matches!', self::ROUTE_MATCHES, $name, $route);
148148

149-
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
149+
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
150150
}
151151

152152
return [];

Matcher/UrlMatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected function matchCollection(string $pathinfo, RouteCollection $routes)
192192
continue;
193193
}
194194

195-
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : []));
195+
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, $status[1] ?? []));
196196
}
197197

198198
return [];

RequestContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public function setParameters(array $parameters)
293293
*/
294294
public function getParameter(string $name)
295295
{
296-
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
296+
return $this->parameters[$name] ?? null;
297297
}
298298

299299
/**

Route.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function setOption(string $name, $value)
300300
*/
301301
public function getOption(string $name)
302302
{
303-
return isset($this->options[$name]) ? $this->options[$name] : null;
303+
return $this->options[$name] ?? null;
304304
}
305305

306306
/**
@@ -369,7 +369,7 @@ public function addDefaults(array $defaults)
369369
*/
370370
public function getDefault(string $name)
371371
{
372-
return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
372+
return $this->defaults[$name] ?? null;
373373
}
374374

375375
/**
@@ -457,7 +457,7 @@ public function addRequirements(array $requirements)
457457
*/
458458
public function getRequirement(string $key)
459459
{
460-
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
460+
return $this->requirements[$key] ?? null;
461461
}
462462

463463
/**

RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function all()
114114
*/
115115
public function get(string $name)
116116
{
117-
return isset($this->routes[$name]) ? $this->routes[$name] : null;
117+
return $this->routes[$name] ?? null;
118118
}
119119

120120
/**

0 commit comments

Comments
 (0)