DoctrineORMEntityManager::initializeProxy() 的声明必须兼容 ProxyManager\Proxy\LazyLoadingInterface::initializeProxy(): bool

Declaration of DoctrineORMEntityManager ::initializeProxy() must be compatible with ProxyManager\Proxy\LazyLoadingInterface::initializeProxy(): bool

当我输入这个命令时 php app/console assetic:dump --env=prod --no-debug 或这个 php app/console cache:clear --env=prod

我收到以下错误:

PHP Fatal error:  Declaration of DoctrineORMEntityManager_0000000035a1d9b70000558a7db0d6e7da5c7b8013722216782206eefb5b6fe5::initializeProxy() must be compatible with ProxyManager\Proxy\LazyLoadingInterface::initializeProxy(): bool in /var/www/myproject/app/cache/prod/appProdProjectContainer.php on line 4459

仅供参考

php --version
PHP 7.2.28 (cli) (built: Feb 18 2020 11:07:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

以前我用php 5.

的时候还行

所以我在评论中说过我不再有这个错误了: 我不得不手动清空我的 "cache" 目录。所以我做了:rm -rf app/cache/prod/ php72 composer.phar dump-autoload php72 composer.phar install --optimize-autoloader

我收到一些警告,但到目前为止它似乎有效...:) –