原理编译错误:void函数一定不能返回值

时间:2018-10-05 10:49:31

标签: php symfony doctrine-orm doctrine

我正在使用PHP 7.2,但出现以下错误:

PHP Fatal error:  A void function must not return a value
Compile Error: A void function must not return a value

之所以会发生这种情况,是因为它看起来像该学说/常见问题不支持return:void。我的composer.json文件中包含以下内容:

    "php": "7.2.*",
    "symfony/symfony": "~3.4",
    "doctrine/orm": "dev-master",
    "doctrine/doctrine-bundle": "~1.5",
    "doctrine/data-fixtures": "dev-master",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "doctrine/migrations": "dev-master",
    "doctrine/doctrine-migrations-bundle": "dev-master",
    "stof/doctrine-extensions-bundle": "dev-master",

但是,似乎该问题最早于2017年1月报告,如下所示:https://github.com/doctrine/doctrine2/issues/6221尚未修复。还是我想念其他东西?

1 个答案:

答案 0 :(得分:0)

因此,答案是在我的作曲家文件中仅使用“ @stable”。

    "doctrine/data-fixtures": "@stable",
    "doctrine/doctrine-fixtures-bundle": "@stable",
    "doctrine/migrations": "@stable",
    "doctrine/doctrine-migrations-bundle": "@stable",
    "stof/doctrine-extensions-bundle": "@stable",