可空字符串类型提示在 PHP 7.2 中给出语法错误
Nullable string type hinting gives syntax error in PHP 7.2
我正在使用 PHP 7.2 并尝试键入提示此变量:
class TestClass
{
public static ?string $test = null;
但是 PHP 给我以下错误:
syntax error, unexpected '?', expecting function (T_FUNCTION) or const
(T_CONST)
我完全不知道为什么!我做错了什么吗?
Typed properties 直到 PHP 7.4.
才包括在内
我正在使用 PHP 7.2 并尝试键入提示此变量:
class TestClass
{
public static ?string $test = null;
但是 PHP 给我以下错误:
syntax error, unexpected '?', expecting function (T_FUNCTION) or const (T_CONST)
我完全不知道为什么!我做错了什么吗?
Typed properties 直到 PHP 7.4.
才包括在内