Skip to content

Commit 9117f2f

Browse files
Apply suggestions from code review
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
1 parent e90c035 commit 9117f2f

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/Symfony/Component/Routing/RequestContext.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ public function __construct(string $baseUrl = '', string $method = 'GET', string
4343
$this->setHttpsPort($httpsPort);
4444
$this->setPathInfo($path);
4545
$this->setQueryString($queryString);
46-
47-
if ($parameters) {
48-
$this->parameters = $parameters;
49-
}
46+
$this->parameters = $parameters ?? $this->parameters;
5047
}
5148

5249
public static function fromUri(string $uri, string $host = 'localhost', string $scheme = 'http', int $httpPort = 80, int $httpsPort = 443): self

src/Symfony/Component/Routing/Tests/RequestContextTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testConstruct()
4141
$this->assertSame(444, $requestContext->getHttpsPort());
4242
$this->assertEquals('/baz', $requestContext->getPathInfo());
4343
$this->assertEquals('bar=foobar', $requestContext->getQueryString());
44-
$this->assertEquals(['foo' => 'bar'], $requestContext->getParameters());
44+
$this->assertSame(['foo' => 'bar'], $requestContext->getParameters());
4545
}
4646

4747
public function testConstructParametersBcLayer()
@@ -54,7 +54,7 @@ public function __construct()
5454
}
5555
};
5656

57-
$this->assertEquals(['foo' => 'bar'], $requestContext->getParameters());
57+
$this->assertSame(['foo' => 'bar'], $requestContext->getParameters());
5858
}
5959

6060
public function testFromUriWithBaseUrl()

0 commit comments

Comments
 (0)