在 symfony 2.8 中,这两个命令都没有在 app/console 工作

Neither command is working at app/console in symfony 2.8

我正在开发 symfony 2.8 项目,我是新手。现在我尝试将其升级到最新版本。我找到了用于更新 symfony 的 rector 包(rector-prefixed exactly,对于旧版本)。我已经安装它并尝试 运行 就像它在文档中一样:https://github.com/rectorphp/rector,并在控制台中出现此错误:

'vendor' is not recognized as an internal or external command,
operable program or batch file.

我没有找到任何关于此类错误的信息,所以我认为这可能是连接控制台错误的问题。例如,当我尝试编写任何命令时:

php app/console list

我得到了这个异常:

#!/usr/bin/env php


  [Symfony\Component\Console\Exception\LogicException]
  An option named "connection" already exists.

我不知道去哪里找问题。我将添加我的控制台文件代码和composer.json,也许有人和我有同样的问题。

#!/usr/bin/env php
<?php

use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);

set_time_limit(0);

require __DIR__.'/autoload.php';

$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';

if ($debug) {
    Debug::enable();
}

$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
{
  "name": "symfony/framework-standard-edition",
  "license": "MIT",
  "type": "project",
  "description": "The \"Symfony Standard Edition\" distribution",
  "autoload": {
    "psr-4": {
      "Tixi\": "src/Tixi/"
    },
    "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"
    }
  }
}

我已经解决了这个问题。首先,Rector 的问题出在命令上。我不知道为什么,但正常命令不适用于我的项目。在 Rector 文档中有:

vendor/bin/rector 

command 但在我的项目中只有:

php bin/rector

所以这个问题就解决了。接下来,我对任何其他命令表单命令行都有疑问。出现逻辑异常。但是我在将 Symfony 从 2.8 升级到 3.x 后处理了这个问题。所以我认为最旧版本的 Symfony 和 php 7.4 版本之间存在冲突。