我在 Symfony 3.1.6 项目中使用 Api-Platform 2.0。
我在我的 API 上工作,当我回到我的项目时,我遇到了这个错误:
AddFormatListener.php 第 131 行中的 FatalErrorException
解析错误:语法错误,意外 ':',期待 ';' 或“{”
这是该文件的代码部分:
private function getNotAcceptableHttpException(string $accept, array $mimeTypes = null): NotAcceptableHttpException
{
if (null === $mimeTypes) {
$mimeTypes = array_keys($this->mimeTypes);
}
return new NotAcceptableHttpException(sprintf(
'Requested format "%s" is not supported. Supported MIME types are "%s".',
$accept,
implode('", "', $mimeTypes)
));
}
当我删除: NotAcceptableHttpException
错误消失但另一个来自 api-platform 文件夹中的另一个文件时。
. 我也尝试通过 composer 和 api-platform 更新我的 symfony 项目,但它没有解决任何问题。但是我收到了一个可能很有趣的警告:
Trying to install assets as relative symbolic links.
Bundle Method / Error
WARNING ApiPlatformBundle copy
但是我不明白这个警告的含义。谢谢