【问题标题】:Symfony Return Type Declarations error when install WellCommerce安装 WellCommerce 时 Symfony 返回类型声明错误
【发布时间】:2016-09-05 13:38:58
【问题描述】:

我用 PHP7 在我的服务器上安装了 symfony3 的 wellCommerce,我收到了这个错误:

FatalErrorException in AdminSubscriber.php line 74:
Parse Error: syntax error, unexpected ':', expecting ';' or '{'

产生这个错误的代码是这个:

private function getUserRepository() : UserRepositoryInterface
{
    return $this->get('user.repository');
}

我阅读了关于 php7 的返回类型声明,但我不知道为什么会出现此错误。

非常感谢您的帮助。

【问题讨论】:

    标签: symfony return-type php-7 symfony-3.1


    【解决方案1】:

    我已经安装了 PHP5.6 和 PHP7,但是 apache 默认使用 PHP5.6。为了解决这个问题,我删除了服务器中的所有 PHP 并安装了 PHP7.1 的最新版本。

    【讨论】:

    • PHP 7.1 还不稳定,暂时使用它可能不是一个好主意。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 1970-01-01
    • 1970-01-01
    • 2016-05-11
    • 2019-02-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多