guard $argv + $token against null, preventing unnecessary exceptions

This commit is contained in:
bilogic 2020-09-09 00:09:14 +08:00 committed by Nicolas Grekas
parent 91b6739031
commit dbe335d9be

View File

@ -49,9 +49,7 @@ class ArgvInput extends Input
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
$argv = $argv ?? $_SERVER['argv'] ?? [];
// strip the application name
array_shift($argv);