Skip to content

Commit cce82fc

Browse files
committed
check for the type instead of against null
1 parent df32cdb commit cce82fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function generate(
142142
return $this->urlGenerator->generate(
143143
$name,
144144
array_merge($attributes, $queryParams),
145-
null !== $request ? SymfonyUrlGeneratorInterface::ABSOLUTE_URL : SymfonyUrlGeneratorInterface::ABSOLUTE_PATH
145+
$request instanceof ServerRequestInterface ? SymfonyUrlGeneratorInterface::ABSOLUTE_URL : SymfonyUrlGeneratorInterface::ABSOLUTE_PATH
146146
);
147147
} catch (SymfonyInvalidParameterException|SymfonyMissingMandatoryParametersException $exception) {
148148
throw RouteGenerationException::create(
@@ -205,7 +205,7 @@ private function getRouteCollection(array $routes): RouteCollection
205205

206206
private function getRequestContext(?ServerRequestInterface $request = null): RequestContext
207207
{
208-
if (null === $request) {
208+
if (!$request instanceof ServerRequestInterface) {
209209
return new RequestContext($this->basePath);
210210
}
211211

0 commit comments

Comments
 (0)