Skip to content

Commit 13a0348

Browse files
committed
Don't introduce runtime failures, just help static analysis
1 parent 356e4c1 commit 13a0348

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/HtaccessCommand.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,17 @@ private function getServerVariables(InputInterface $input): ServerVariables
183183
{
184184
$serverVariables = ServerVariables::default();
185185
if ($referrer = $input->getOption('referrer')) {
186-
if (!is_string($referrer)) {
187-
throw new InvalidArgumentException('Referrer should be a string');
188-
}
186+
/** @var string $referrer */
189187
$serverVariables = $serverVariables->with('HTTP_REFERER', $referrer);
190188
}
191189

192190
if ($serverName = $input->getOption('server-name')) {
193-
if (!is_string($serverName)) {
194-
throw new InvalidArgumentException('Server name should be a string');
195-
}
191+
/** @var string $serverName */
196192
$serverVariables = $serverVariables->with('SERVER_NAME', $serverName);
197193
}
198194

199195
if ($httpUserAgent = $input->getOption('http-user-agent')) {
200-
if (!is_string($httpUserAgent)) {
201-
throw new InvalidArgumentException('Http user agent should be a string');
202-
}
196+
/** @var string $httpUserAgent */
203197
$serverVariables = $serverVariables->with('HTTP_USER_AGENT', $httpUserAgent);
204198
}
205199

0 commit comments

Comments
 (0)