Skip to content

Commit d1d800d

Browse files
committed
[Routing] Use the null coalescing operator
1 parent 5e84142 commit d1d800d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Loader/AnnotationClassLoader.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ protected function addRoute(RouteCollection $collection, object $annot, array $g
150150
return;
151151
}
152152

153-
$name = $annot->getName();
154-
if (null === $name) {
155-
$name = $this->getDefaultRouteName($class, $method);
156-
}
153+
$name = $annot->getName() ?? $this->getDefaultRouteName($class, $method);
157154
$name = $globals['name'].$name;
158155

159156
$requirements = $annot->getRequirements();
@@ -170,11 +167,7 @@ protected function addRoute(RouteCollection $collection, object $annot, array $g
170167
$schemes = array_merge($globals['schemes'], $annot->getSchemes());
171168
$methods = array_merge($globals['methods'], $annot->getMethods());
172169

173-
$host = $annot->getHost();
174-
if (null === $host) {
175-
$host = $globals['host'];
176-
}
177-
170+
$host = $annot->getHost() ?? $globals['host'];
178171
$condition = $annot->getCondition() ?? $globals['condition'];
179172
$priority = $annot->getPriority() ?? $globals['priority'];
180173

0 commit comments

Comments
 (0)