Skip to content

Commit 7c194b9

Browse files
minor #46844 [HttpKernel] remove else logic (Nil Borodulia)
This PR was merged into the 6.2 branch. Discussion ---------- [HttpKernel] remove else logic | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | none | License | MIT | Doc PR | none Refactoring. Removed else logic for more understanding. Commits ------- 3ad51d7 remove else logic
2 parents 4ed6ca8 + 3ad51d7 commit 7c194b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Component/HttpKernel/UriSigner.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public function __construct(string $secret, string $parameter = '_hash')
4242
public function sign(string $uri): string
4343
{
4444
$url = parse_url($uri);
45+
$params = [];
46+
4547
if (isset($url['query'])) {
4648
parse_str($url['query'], $params);
47-
} else {
48-
$params = [];
4949
}
5050

5151
$uri = $this->buildUrl($url, $params);
@@ -60,10 +60,10 @@ public function sign(string $uri): string
6060
public function check(string $uri): bool
6161
{
6262
$url = parse_url($uri);
63+
$params = [];
64+
6365
if (isset($url['query'])) {
6466
parse_str($url['query'], $params);
65-
} else {
66-
$params = [];
6767
}
6868

6969
if (empty($params[$this->parameter])) {
@@ -101,7 +101,7 @@ private function buildUrl(array $url, array $params = []): string
101101
$pass = isset($url['pass']) ? ':'.$url['pass'] : '';
102102
$pass = ($user || $pass) ? "$pass@" : '';
103103
$path = $url['path'] ?? '';
104-
$query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : '';
104+
$query = $url['query'] ? '?'.$url['query'] : '';
105105
$fragment = isset($url['fragment']) ? '#'.$url['fragment'] : '';
106106

107107
return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;

0 commit comments

Comments
 (0)