Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将php从5.6升级到7.4后,symfony 2.8项目中的AppKernel.php出现问题_Php_Console_Composer Php_Symfony 2.8 - Fatal编程技术网

将php从5.6升级到7.4后,symfony 2.8项目中的AppKernel.php出现问题

将php从5.6升级到7.4后,symfony 2.8项目中的AppKernel.php出现问题,php,console,composer-php,symfony-2.8,Php,Console,Composer Php,Symfony 2.8,最后几天我尝试一步一步地升级我的项目。我有Symfony 2.8,作曲家2。最近我找到了要升级的rector/rector包,但在尝试安装它时发生了冲突。接下来,我尝试安装rector/rector前缀。它也给安装带来了很多问题,但经过研究,我已经将我的php版本更新为7.4,并且运行良好。我已经对composer进行了更新和安装,但同时出现了新的错误。使用AppKernel。之前,一切都很好,应用程序运行良好。现在我在浏览器中看到一条消息:Composer在您的平台中检测到问题:“您的Comp

最后几天我尝试一步一步地升级我的项目。我有Symfony 2.8,作曲家2。最近我找到了要升级的rector/rector包,但在尝试安装它时发生了冲突。接下来,我尝试安装rector/rector前缀。它也给安装带来了很多问题,但经过研究,我已经将我的php版本更新为7.4,并且运行良好。我已经对composer进行了更新和安装,但同时出现了新的错误。使用AppKernel。之前,一切都很好,应用程序运行良好。现在我在浏览器中看到一条消息:Composer在您的平台中检测到问题:“您的Composer依赖项需要PHP版本”>=7.4.0”

在控制台中,在每个命令之后(例如:php app/console list),现在我收到以下消息:

#!/usr/bin/env php
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TixiCoreDomainBundle" from namespace "Tixi\CoreDomainBundle".
Did you forget a "use" statement for "Tixi\CoreDomainBundle\TixiCoreDomainBundle"? in C:\Users\Developer\PhpstormProjects\sfitixi\app\AppKernel.php:32
Stack trace:
#0 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(427): AppKernel->registerBundles()
#1 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()
#3 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Compone in C:\Users\Developer\Phpstor
mProjects\sfitixi\app\AppKernel.php on line 32

Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TixiCoreDomainBundle" from namespace "Tixi\CoreDomainBundle".
Did you forget a "use" statement for "Tixi\CoreDomainBundle\TixiCoreDomainBundle"? in C:\Users\Developer\PhpstormProjects\sfitixi\app\AppKernel.php:32
Stack trace:
#0 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(427): AppKernel->registerBundles()
#1 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(128): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(62): Symfony\Component\HttpKernel\Kernel->boot()
#3 C:\Users\Developer\PhpstormProjects\sfitixi\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Compone in C:\Users\Developer\Phpstor
mProjects\sfitixi\app\AppKernel.php on line 32

这是我在AppKernel.php中的内容:

public function registerBundles(): array
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            new Tixi\CoreDomainBundle\TixiCoreDomainBundle(),
            new Tixi\ApiBundle\TixiApiBundle(),
            new Tixi\SecurityBundle\TixiSecurityBundle(),
            new Tixi\App\AppBundle\TixiAppBundle(),
            new FOS\RestBundle\FOSRestBundle(),
            new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new APY\BreadcrumbTrailBundle\APYBreadcrumbTrailBundle(),
            new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }
我试着写use语句,但没有改变任何事情。 My composer.json:

{
  "name": "symfony/framework-standard-edition",
  "license": "MIT",
  "type": "project",
  "description": "The \"Symfony Standard Edition\" distribution",
  "autoload": {
    "psr-4": {
      "Tixi\\": "src/"
    },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
  },
  "autoload-dev": {
    "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
  },
  "require": {
    "php": "~7.4",
    "ext-json": "*",
    "apy/breadcrumbtrail-bundle": "1.3.*",
    "composer/ca-bundle": "~1.2.7",
    "doctrine/doctrine-bundle": "~1.4",
    "doctrine/doctrine-migrations-bundle": "1.3.*",
    "doctrine/orm": "^2.4.8",
    "egulias/email-validator": "~1.2",
    "friendsofsymfony/oauth-server-bundle": "1.5.*",
    "friendsofsymfony/rest-bundle": "1.7.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "jms/serializer-bundle": "1.5.*",
    "knplabs/knp-snappy-bundle": "1.5.*",
    "mediaburst/clockworksms": "2.0.*",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "symfony/monolog-bundle": "^3.0.2",
    "symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
    "symfony/symfony": "2.8.*",
    "twig/extensions": "1.5.*",
    "twig/twig": "^1.0||^2.0"
  },
  "require-dev": {
    "rector/rector-prefixed": "^0.9.31",
    "sensio/generator-bundle": "~3.0",
    "symfony/phpunit-bridge": "~2.7"
  },
  "scripts": {
    "symfony-scripts": [
      "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::prepareDeploymentTarget"
    ],
    "post-install-cmd": [
      "@symfony-scripts"
    ],
    "post-update-cmd": [
      "@symfony-scripts"
    ]
  },
  "config": {
    "bin-dir": "bin",
    "platform": {
      "php": "7.4"
    },
    "sort-packages": true,
    "discard-changes": true
  },
  "extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
      "file": "app/config/parameters.yml"
    },
    "branch-alias": {
      "dev-master": "2.8-dev"
    }
  }
}
有人知道如何解决这个问题吗

编辑(11.03.2021)

是的,这个类是存在的。问题是每4个名称空间以Tixi开头的类。这个类是空的,它们从Symfony扩展了Bundle类。它们是这样的:

<?php

namespace Tixi\ApiBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * Class TixiApiBundle
 * @package Tixi\ApiBundle
 */
class TixiApiBundle extends Bundle
{
}

自动加载器配置不正确:

  "autoload": {
    "psr-4": {
      "Tixi\\": "src/"
    },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
  },
这告诉自动加载程序在
src
中搜索
Tixi
命名空间中的所有类。据此,类
Tixi\CoreDomainBundle\TixiCoreDomainBundle
应该位于
src/CoreDomainBundle/TixiCoreDomainBundle.php
,但它位于
src/Tixi/CoreDomainBundle/TixiCoreDomainBundle.php


Tixi
子文件夹中的所有内容上移一级,或者调整类加载器设置-将其更改为
src/Tixi/
可能会有帮助

自动加载器配置不正确:

  "autoload": {
    "psr-4": {
      "Tixi\\": "src/"
    },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
  },
这告诉自动加载程序在
src
中搜索
Tixi
命名空间中的所有类。据此,类
Tixi\CoreDomainBundle\TixiCoreDomainBundle
应该位于
src/CoreDomainBundle/TixiCoreDomainBundle.php
,但它位于
src/Tixi/CoreDomainBundle/TixiCoreDomainBundle.php


Tixi
子文件夹中的所有内容向上移动一级,或者调整您的类加载器设置-将其更改为
src/Tixi/
可能会有所帮助

请共享更多详细信息-您是否检查了类
TixiCoreDomainBundle
是否存在?如果是,请共享该类的位置(我假设类加载器找不到它),我添加了您要求的更多详细信息。其他3个类与此类完全相同。请分享更多详细信息-您是否检查了类
TixiCoreDomainBundle
是否存在?如果是,请共享该类的位置(我假设类加载器找不到它),我添加了您要求的更多详细信息。其他三门课和这门课完全一样。是的,这个答案是正确的。名称空间是错误的。但接下来我有另一个问题。我将编辑我的问题并添加新的错误跟踪。如果您有新问题,请打开新问题是的,此答案是正确的。名称空间是错误的。但接下来我有另一个问题。我将编辑我的问题并添加新的错误跟踪。如果有新问题,请打开新问题