在 php (?int) 中,类型声明前的问号 (?) 是什么意思
我在 https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Output/Output.php 行40中看到过这个代码,他们正在使用?int。
public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = $formatter ?: new OutputFormatter();
$this->formatter->setDecorated($decorated);
}