Skip to content

Commit b900f53

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: CS: Apply ternary_to_null_coalescing fixer
2 parents fb0f2aa + 4118225 commit b900f53

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
@@ -311,7 +311,7 @@ public function setOption(string $name, $value)
311311
*/
312312
public function getOption(string $name)
313313
{
314-
return isset($this->options[$name]) ? $this->options[$name] : null;
314+
return $this->options[$name] ?? null;
315315
}
316316

317317
/**
@@ -380,7 +380,7 @@ public function addDefaults(array $defaults)
380380
*/
381381
public function getDefault(string $name)
382382
{
383-
return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
383+
return $this->defaults[$name] ?? null;
384384
}
385385

386386
/**
@@ -468,7 +468,7 @@ public function addRequirements(array $requirements)
468468
*/
469469
public function getRequirement(string $key)
470470
{
471-
return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
471+
return $this->requirements[$key] ?? null;
472472
}
473473

474474
/**

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)