phpsymfonycomposer-php

Problem with symfony/var-dumper in composer.lock


I've got a problem with my composer.lock when I launch my composer install.

I've got an error :

Installation request for symfony/var-dumper v4.0.12 -> satisfiable by symfony/var-dumper[v4.0.12].

So I remove this from my composer.lock:

{
    "name": "symfony/var-dumper",
    "version": "v4.0.12",
    "source": {
        "type": "git",
        "url": "https://github.com/symfony/var-dumper.git",
        "reference": "f670984c74fa1e92e68c6e50fe9eebc3fc4d1923"
    },
    "dist": {
        "type": "zip",
        "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f670984c74fa1e92e68c6e50fe9eebc3fc4d1923",
        "reference": "f670984c74fa1e92e68c6e50fe9eebc3fc4d1923",
        "shasum": ""
    },
    "require": {
        "php": "^7.1.3",
        "symfony/polyfill-mbstring": "~1.0",
        "symfony/polyfill-php72": "~1.5"
    },
    "conflict": {
        "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
    },
    "require-dev": {
        "ext-iconv": "*",
        "twig/twig": "~1.34|~2.4"
    },
    "suggest": {
        "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
        "ext-intl": "To show region name in time zone dump"
    },
    "type": "library",
    "extra": {
        "branch-alias": {
            "dev-master": "4.0-dev"
        }
    },
    "autoload": {
        "files": [
            "Resources/functions/dump.php"
        ],
        "psr-4": {
            "Symfony\\Component\\VarDumper\\": ""
        },
        "exclude-from-classmap": [
            "/Tests/"
        ]
    },
    "notification-url": "https://packagist.org/downloads/",
    "license": [
        "MIT"
    ],
    "authors": [
        {
            "name": "Nicolas Grekas",
            "email": "p@tchwork.com"
        },
        {
            "name": "Symfony Community",
            "homepage": "https://symfony.com/contributors"
        }
    ],
    "description": "Symfony mechanism for exploring and dumping PHP variables",
    "homepage": "https://symfony.com",
    "keywords": [
        "debug",
        "dump"
    ],
    "time": "2018-06-15 07:52:13"
}

And everything works in the composer install command!

So, the question is ..... Why I've got this problem when I put it on my composer.lock? It was a good practice to remove it or not? Can I solve it with another solution?

Notice: I'm with PHP7.1.17 and Symfony3.3.


Solution

  • You are not supposed to change contents of composer.lock file. you just set your version constraints on composer.json and with composer install, you let composer resolve dependencies for you.

    composer.lock is created automatically by composer and you should leave it unchanged.

    If you have problems with composer.lock and your are developing in your own (you have not any collaborators), then you may simply remove composer.lock file and run composer install again.