当我运行composer update
时,调用cache:clear
脚本时出现以下错误。
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
PHP Fatal error: Class 'Doctrine\Common\Inflector\Inflector' not found in /home/sarah/workspace/telematics_tracker/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php on line 29
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Class 'Doctrine\Common\Inflector\Inflector' not found in /home/sarah/workspace/telematics_tracker/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php on line 29
PHP Stack trace:
PHP 1. Symfony\Component\Debug\ErrorHandler->handleException() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:0
PHP 2. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->handleError() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php:557
PHP 3. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->getClassCandidates() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatal
ErrorHandler.php:62
PHP 4. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->findClassInPath() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErr
orHandler.php:118
PHP 5. Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler->convertFileToClass() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatal
ErrorHandler.php:143
PHP 6. require_once() /home/sarah/workspace/telematics_tracker/vendor/symfony/symfony/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php:188
Segmentation fault (core dumped)
Composer.json
{
...
"require" : {
...
"doctrine/common" : "^2.7",
"doctrine/dbal" : "^2.5",
"doctrine/doctrine-bundle" : "^1.6",
"doctrine/doctrine-cache-bundle" : "^1.2",
"doctrine/orm" : "^2.5",
"incenteev/composer-parameter-handler" : "^2.0",
"sensio/distribution-bundle" : "^5.0",
"sensio/framework-extra-bundle" : "^3.0.2",
"sensio/generator-bundle" : "^3.1",
},
"require-dev\"" : {
"sensio/generator-bundle" : "^3.0",
"symfony/phpunit-bridge" : "^3.0",
"phpunit/phpunit" : "^5.6",
"phpunit/php-invoker" : "^1.1"
},
"scripts" : {
"post-root-package-install" : "SymfonyStandard\\Composer::hookRootPackageInstall",
"post-install-cmd" : [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
],
"post-update-cmd" : [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
]
},
"extra" : {
"symfony-app-dir" : "app",
"symfony-bin-dir" : "bin",
"symfony-var-dir" : "var",
"symfony-web-dir" : "web",
"symfony-tests-dir" : "tests",
"symfony-assets-install" : "relative",
"incenteev-parameters" : {
"file" : "app/config/parameters.yml"
}
},
"minimum-stability" : "dev"
}
Inflector.php位于正确的位置,包含以下内容。
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Util;
use Doctrine\Common\Inflector\Inflector as BaseInflector;
/**
* Doctrine inflector has static methods for inflecting text.
*
* Kept for backwards compatibility reasons, was moved to its own component.
*/
class Inflector extends BaseInflector
{
}
我在docblock Kept for backwards compatibility reasons, was moved to its own component
中看到了评论。
有谁知道它被移到哪里了?
如何获取缓存:清除以调用正确的类?
答案 0 :(得分:0)
今天早上运行composer update
安装了新版本的doctrine / inflector Installing doctrine/inflector (1.2.x-dev e11d84c)
,我不再收到此错误。
答案 1 :(得分:0)
将您的php
版本更新为7.2
或更高版本