Laravel 5.8: beberlei/assert/lib/Assert/functions.php return 类型产生错误

Laravel 5.8: beberlei/assert/lib/Assert/functions.php return type produces error

我在本地服务器上安装了 Laravel 5.8 它工作正常,但在远程服务器上它报告错误

Parse error: syntax error, unexpected ':', expecting '{' in /***/vendor/beberlei/assert/lib/Assert/functions.php on line 37

这是产生错误的行

function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain
{
    return Assert::that($value, $defaultMessage, $defaultPropertyPath);
}

我认为PHP版本无法理解return类型或Scalar类型的字符串。服务器的PHP版本是7.3.13,return类型和标量类型sting在这个版本中是有效的语句,但仍然报错。你们有谁知道为什么会这样吗?

提前致谢

您的应用在通过 http://mheidari.me/tour.mheidari.me/public/ 访问时可以运行。

通过 http://tour.mheidari.me/public/.

访问时,您的应用无法运行

这意味着您的虚拟主机分配了不同的 PHP 版本,并且您收到的错误只会出现在 PHP 早于 PHP 7 的版本中。