json - 将 Symfony 从 2.8 升级到 3.1 : "Your requirements could not be resolved to an installable set of packages."

标签 json symfony composer-php symfony-3.1

所以我用 Symfony 2.8.6 开发了这个博客。我注意到 Symfony3.1 LTS版本可用并希望升级。因此,我修复了所有弃用调用。

我抓取了 Symfony3.1 的 composer.json 文件并尝试运行

$ composer update

但是,更新失败,我得到以下输出:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit 5.3.4 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpunit/phpunit 5.3.0 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpunit/phpunit 5.3.1 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpunit/phpunit 5.3.2 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpunit/phpunit 5.3.3 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpunit/phpunit 5.3.4 requires phpspec/prophecy ^1.3.1 -> satisfiable by phpspec/prophecy[v1.6.0, 1.4.0, v1.3.1, v1.4.1, v1.5.0].
    - phpspec/prophecy v1.6.0 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpspec/prophecy 1.4.0 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpspec/prophecy v1.3.1 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpspec/prophecy v1.4.1 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpspec/prophecy v1.5.0 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpspec/prophecy v1.6.0 requires phpdocumentor/reflection-docblock ~2.0 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3].
    - phpdocumentor/reflection-docblock 2.0.0 conflicts with symfony/symfony[v3.1.0].
    - phpdocumentor/reflection-docblock 2.0.1 conflicts with symfony/symfony[v3.1.0].
    - phpdocumentor/reflection-docblock 2.0.2 conflicts with symfony/symfony[v3.1.0].
    - phpdocumentor/reflection-docblock 2.0.3 conflicts with symfony/symfony[v3.1.0].
    - phpdocumentor/reflection-docblock 2.0.4 conflicts with symfony/symfony[v3.1.0].
    - symfony/symfony v3.1.0 conflicts with phpdocumentor/reflection-docblock[2.0.4].
    - Installation request for symfony/symfony 3.1.* -> satisfiable by symfony/symfony[v3.1.0].
    - Installation request for phpunit/phpunit 5.3.* -> satisfiable by phpunit/phpunit[5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.4].

这是我的composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "autoload-dev": {
        "psr-4": { "Tests\\": "tests/" }
    },
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.1.*",
        "doctrine/orm": "^2.5",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-cache-bundle": "^1.2",
        "symfony/swiftmailer-bundle": "^2.3",
        "symfony/monolog-bundle": "^2.8",
        "symfony/polyfill-apcu": "^1.0",
        "sensio/distribution-bundle": "^5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "symfony/assetic-bundle": "^2.7",
        "knplabs/knp-time-bundle": "^1.6",
        "eko/feedbundle": "^1.2",
        "friendsofsymfony/user-bundle": "dev-master",
        "lexik/maintenance-bundle": "dev-master",
        "phpunit/phpunit": "5.3.*"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "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::prepareDeploymentTarget"
        ],
        "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::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "5.6.16"
        }
    },
    "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"
        },
        "branch-alias": {
            "dev-master": "3.1-dev"
        }
    }
}

我还尝试在运行 composer update 时添加 --with-dependencies 选项,但无济于事。

有人知道哪个包有冲突吗?

最佳答案

这是由于a conflict between Symfony 3.1 and phpdocumentor/reflection-docblock: <3.0 (这是 PHPUnit 所必需的),这是在 composer.json 中声明的文件:

"conflict": {
    "phpdocumentor/reflection-docblock": "<3.0"
},

来源:https://github.com/symfony/symfony/blob/b004243cb31059f9a97c0a1a045c2dbd1a77dee8/composer.json#L92

您有几种解决方案:

关于json - 将 Symfony 从 2.8 升级到 3.1 : "Your requirements could not be resolved to an installable set of packages.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37545550/

相关文章:

php - 使用 doctrine 和 Symfony 2 加入子查询

php - Sonata Admin Bundle 自定义查询列表以使用现有存储库

php - 包迁移不起作用(没有错误)

java - 使用 json 时应该使用哪些 jar 库

ios - 使用 Swift 字典解析 JSON

php - Symfony:具有灵活关系的实体及其(子)形式 - 如何设计?

php - 如何在 Laravel 4 中自动加载 Guzzle?

php - 无法通过 Composer 安装 DoctrineMigrationsBundle

javascript - 多个相交过滤器Google map API

json - Cloudformation 列表和字符串::SecurityGroupIds 属性的值必须是字符串列表类型