Skip to content

Commit 7e85301

Browse files
[HttpFoundation][HttpKernel] Remove dead code and useless casts
1 parent 1a9b7d5 commit 7e85301

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

BinaryFileResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function setFile(\SplFileInfo|string $file, ?string $contentDisposition =
7070
if ($file instanceof \SplFileInfo) {
7171
$file = new File($file->getPathname(), !$isTemporaryFile);
7272
} else {
73-
$file = new File((string) $file);
73+
$file = new File($file);
7474
}
7575
}
7676

File/File.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ protected function getName(string $name): string
134134
{
135135
$originalName = str_replace('\\', '/', $name);
136136
$pos = strrpos($originalName, '/');
137-
$originalName = false === $pos ? $originalName : substr($originalName, $pos + 1);
138137

139-
return $originalName;
138+
return false === $pos ? $originalName : substr($originalName, $pos + 1);
140139
}
141140
}

HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function get(string $key, ?string $default = null): ?string
118118
return null;
119119
}
120120

121-
return (string) $headers[0];
121+
return $headers[0];
122122
}
123123

124124
/**

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1878,7 +1878,7 @@ protected function preparePathInfo(): string
18781878
}
18791879

18801880
$pathInfo = substr($requestUri, \strlen($baseUrl));
1881-
if (false === $pathInfo || '' === $pathInfo) {
1881+
if ('' === $pathInfo) {
18821882
// If substr() returns false then PATH_INFO is set to an empty string
18831883
return '/';
18841884
}

Test/Constraint/ResponseCookieValueSame.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ public function toString(): string
3434
if ($this->domain) {
3535
$str .= \sprintf(' for domain "%s"', $this->domain);
3636
}
37-
$str .= \sprintf(' with value "%s"', $this->value);
3837

39-
return $str;
38+
return $str.\sprintf(' with value "%s"', $this->value);
4039
}
4140

4241
/**

0 commit comments

Comments
 (0)