phpsymfonycomposer-phpphpcs

Cannot install friendsofphp/php-cs-fixer on Symfony 5.4 and PHP 8.2


I'm on a symfony 5.4 installation with PHP 8.2 and I'm trying to require friendsofphp/php-cs-fixer with

composer require friendsofphp/php-cs-fixer -W --dev

Unfortunately I'm getting the following conflicts but I can't see the exact steps I need to take to fix the conflicts. All changed/updates I did weren't successful.

Problem 1
    - Root composer.json requires symfony/symfony 5.4.*, found symfony/symfony[v5.4.0, ..., v5.4.25] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - Root composer.json requires symfony/twig-bundle ^5.4, found symfony/twig-bundle[v5.4.0, ..., v5.4.21] but these were not loaded, likely because it conflicts with another require.
  Problem 3
    - Root composer.json requires symfony/web-profiler-bundle 5.4.*, found symfony/web-profiler-bundle[v5.4.0, ..., v5.4.24] but these were not loaded, likely because it conflicts with another require.
  Problem 4
    - doctrine/doctrine-bundle is locked to version 2.10.1 and an update of this package was not requested.
    - doctrine/doctrine-bundle 2.10.1 requires symfony/cache ^5.4 || ^6.0 -> found symfony/cache[v5.4.0, ..., v5.4.25, v6.0.0, ..., v6.3.1] but these were not loaded, likely because it conflicts with another require.
  Problem 5
    - doctrine/doctrine-fixtures-bundle is locked to version 3.4.4 and an update of this package was not requested.
    - doctrine/doctrine-fixtures-bundle 3.4.4 requires symfony/config ^3.4|^4.3|^5.0|^6.0 -> found symfony/config[v3.4.0, ..., v3.4.47, v4.3.0, ..., v4.4.44, v5.0.0, ..., v5.4.21, v6.0.0, ..., v6.3.0] but these were not loaded, likely because it conflicts with another require.
  Problem 6
    - jms/serializer-bundle is locked to version 5.3.1 and an update of this package was not requested.
    - jms/serializer-bundle 5.3.1 requires symfony/dependency-injection ^3.4 || ^4.0 || ^5.0 || ^6.0 -> found symfony/dependency-injection[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.49, v5.0.0, ..., v5.4.25, v6.0.0, ..., v6.3.1] but these were not loaded, likely because it conflicts with another require.
  Problem 7
    - knplabs/knp-menu-bundle is locked to version v3.1.0 and an update of this package was not requested.
    - knplabs/knp-menu-bundle v3.1.0 requires symfony/framework-bundle ^3.4 | ^4.4 | ^5.0 -> found symfony/framework-bundle[v3.4.0, ..., v3.4.47, v4.4.0, ..., v4.4.49, v5.0.0, ..., v5.4.25] but these were not loaded, likely because it conflicts with another require.
  Problem 8
    - sensio/framework-extra-bundle is locked to version v6.2.10 and an update of this package was not requested.
    - sensio/framework-extra-bundle v6.2.10 requires symfony/config ^4.4|^5.0|^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.0.0, ..., v5.4.21, v6.0.0, ..., v6.3.0] but these were not loaded, likely because it conflicts with another require.
  Problem 9
    - symfony/monolog-bundle is locked to version v3.8.0 and an update of this package was not requested.
    - symfony/monolog-bundle v3.8.0 requires symfony/config ~4.4 || ^5.0 || ^6.0 -> found symfony/config[v4.4.0, ..., v4.4.44, v5.0.0, ..., v5.4.21, v6.0.0, ..., v6.3.0] but these were not loaded, likely because it conflicts with another require.
  Problem 10
    - symfony/psr-http-message-bridge is locked to version v2.2.0 and an update of this package was not requested.
    - symfony/psr-http-message-bridge v2.2.0 requires symfony/http-foundation ^5.4 || ^6.0 -> found symfony/http-foundation[v5.4.0, ..., v5.4.25, v6.0.0, ..., v6.3.1] but these were not loaded, likely because it conflicts with another require.
  Problem 11
    - symfony/serializer-pack is locked to version v1.3.0 and an update of this package was not requested.
    - symfony/serializer-pack v1.3.0 requires symfony/property-access * -> found symfony/property-access[v2.2.0, ..., v2.8.52, v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.44, v5.0.0, ..., v5.4.22, v6.0.0, ..., v6.3.0] but these were not loaded, likely because it conflicts with another require.
  Problem 12
    - symfony/webpack-encore-bundle is locked to version v2.0.1 and an update of this package was not requested.
    - symfony/webpack-encore-bundle v2.0.1 requires symfony/asset ^5.4 || ^6.2 -> found symfony/asset[v5.4.0, ..., v5.4.21, v6.2.0, v6.2.5, v6.2.7, v6.3.0] but these were not loaded, likely because it conflicts with another require.

Following my composer.json:

{
  "name": "some/name",
  "description": "some description",
  "license": [
    "proprietary"
  ],
  "type": "project",
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "flot/flot",
        "version": "v0.8.3",
        "source": {
          "url": "https://github.com/flot/flot",
          "type": "git",
          "reference": "v0.8.3"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "briancherne/jquery-hoverIntent",
        "version": "v1.8.1",
        "source": {
          "url": "https://github.com/briancherne/jquery-hoverIntent",
          "type": "git",
          "reference": "v1.8.1"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "pupunzi/jquery.mb.flipText",
        "version": "1.1",
        "source": {
          "url": "https://github.com/pupunzi/jquery.mb.flipText",
          "type": "git",
          "reference": "1.1"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "pupunzi/jquery.mb.extruder",
        "version": "2.4.0",
        "source": {
          "url": "https://github.com/pupunzi/jquery.mb.extruder",
          "type": "git",
          "reference": "2.4.0"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "botmonster/jquery-bootpag",
        "version": "1.0.5",
        "source": {
          "url": "https://github.com/botmonster/jquery-bootpag",
          "type": "git",
          "reference": "1.0.5"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "makeusabrew/bootbox",
        "version": "v4.3.0",
        "source": {
          "url": "https://github.com/makeusabrew/bootbox",
          "type": "git",
          "reference": "v4.3.0"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "Sjeiti/TinySort",
        "version": "v1.5.6",
        "source": {
          "url": "https://github.com/Sjeiti/TinySort",
          "type": "git",
          "reference": "v1.5.6"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "sciactive/pnotify",
        "version": "2.0.1",
        "source": {
          "url": "https://github.com/sciactive/pnotify",
          "type": "git",
          "reference": "2.0.1"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "browserstate/history.js",
        "version": "1.8.0",
        "source": {
          "url": "https://github.com/browserstate/history.js",
          "type": "git",
          "reference": "1.8.0"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "vitalets/x-editable",
        "version": "1.5.1",
        "source": {
          "url": "https://github.com/vitalets/x-editable",
          "type": "git",
          "reference": "1.5.1"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "Mottie/tablesorter",
        "version": "v2.23.3",
        "source": {
          "url": "https://github.com/Mottie/tablesorter",
          "type": "git",
          "reference": "v2.23.3"
        }
      }
    },{
      "type": "package",
      "package": {
        "name": "Uni-tel/flot-rangeselect",
        "version": "1.3",
        "source": {
          "url": "https://github.com/Uni-tel/flot-rangeselect",
          "type": "git",
          "reference": "1.3"
        }
      }
    },


    {
      "type": "package",
      "package": {
        "name": "markrcote/flot-axislabels",
        "version": "2.0.1",
        "source": {
          "url": "https://github.com/markrcote/flot-axislabels",
          "type": "git",
          "reference": "release-2.0.1"
        }
      }
    },

    {
      "type": "git",
      "url": "https://github.com/Schluepfer/bootstrap-bundle.git"
    }
  ],
  "require": {
    "php": "^8.0",
    "ext-json": "*",
    "ext-mysqli": "*",
    "aws/aws-sdk-php": "3.271.*",
    "beberlei/doctrineextensions": "1.3.*",
    "botmonster/jquery-bootpag": "~1.0.5",
    "briancherne/jquery-hoverintent": "~1.8.1",
    "browserstate/history.js": "1.8.*",
    "components/jquery": "~1.11.3",
    "doctrine/common": "^3.3",
    "doctrine/dbal": "^3.3",
    "doctrine/doctrine-bundle": "^2.10",
    "doctrine/doctrine-fixtures-bundle": "^3.4",
    "doctrine/orm": "^2.12",
    "doctrine/persistence": "^3.0",
    "eonasdan/bootstrap-datetimepicker": "4.17.*",
    "firebase/php-jwt": "^5.0",
    "flot/flot": "~0.8.3",
    "fortawesome/font-awesome": "4.7.*",
    "ivaynberg/select2": "~3.5.4",
    "jms/serializer-bundle": "^5.3",
    "kartik-v/bootstrap-fileinput": "~4.2.7",
    "knplabs/knp-menu": "^3.3",
    "knplabs/knp-menu-bundle": "^3.1",
    "lcobucci/jwt": "5.0.*",
    "league/oauth2-client": "2.7.*",
    "league/oauth2-server": "8.5.*",
    "makeusabrew/bootbox": "4.3.*",
    "markrcote/flot-axislabels": "~2.0.1",
    "mikehaertl/php-pdftk": "~0.3.2",
    "mikehaertl/php-shellcommand": "^1.0.2",
    "mikehaertl/php-tmpfile": "^1.0.0",
    "mnsami/composer-custom-directory-installer": "^2.0.0",
    "moment/moment": "2.29.*",
    "monolog/monolog": "2.9.*",
    "mottie/tablesorter": "~2.23.3",
    "nyholm/psr7": "^1.3",
    "phpoffice/phpspreadsheet": "^1.23",
    "pupunzi/jquery.mb.extruder": "2.4.*",
    "pupunzi/jquery.mb.fliptext": "1.1.*",
    "sciactive/pnotify": "~2.0.1",
    "sensio/framework-extra-bundle": "^6.2",
    "sjeiti/tinysort": "~1.5.6",
    "spomky-labs/otphp": "^10.0",
    "symfony/console": "^5.4",
    "symfony/monolog-bundle": "^3.8",
    "symfony/polyfill-apcu": "^1.0",
    "symfony/psr-http-message-bridge": "^2.2",
    "symfony/serializer-pack": "^1.3",
    "symfony/symfony": "^5.4",
    "symfony/twig-bundle": "^5.4",
    "symfony/webpack-encore-bundle": "^2.0",
    "tecnickcom/tcpdf": "6.6.*",
    "tetranz/select2entity-bundle": "2.9.*",
    "twbs/bootstrap": "~3.3.7",
    "twig/twig": "^2.14",
    "uni-tel/flot-rangeselect": "1.3.*",
    "vitalets/x-editable": "~1.5.1",
    "zendframework/zend-diactoros": "1.3.*"
  },
  "require-dev": {
    "hamcrest/hamcrest-php": "v1.2.2",
    "phpunit/phpunit": "9.6.*",
    "symfony/phpunit-bridge": "6.3.*",
    "symfony/web-profiler-bundle": "^5.4"
  },
  "extra": {
    "symfony-app-dir": "app",
    "symfony-bin-dir": "bin",
    "symfony-var-dir": "var",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "installer-paths": {
      "public_html/vendor/jquery-bootpag": [
        "botmonster/jquery-bootpag"
      ],
      "public_html/vendor/jquery-hoverIntent": [
        "briancherne/jquery-hoverintent"
      ],
      "public_html/vendor/flot": [
        "flot/flot"
      ],
      "public_html/vendor/font-awesome": [
        "fortawesome/font-awesome"
      ],
      "public_html/vendor/bootbox": [
        "makeusabrew/bootbox"
      ],
      "public_html/vendor/composer-custom-directory-installer": [
        "mnsami/composer-custom-directory-installer"
      ],
      "public_html/vendor/jquery.mb.flipText": [
        "pupunzi/jquery.mb.flipText"
      ],
      "public_html/vendor/jquery.mb.extruder": [
        "pupunzi/jquery.mb.extruder"
      ],
      "public_html/vendor/x-editable": [
        "vitalets/x-editable"
      ],
      "public_html/vendor/bootstrap": [
        "twbs/bootstrap"
      ],
      "public_html/vendor/bootstrap-datetimepicker": [
        "eonasdan/bootstrap-datetimepicker"
      ],
      "public_html/vendor/select2": [
        "ivaynberg/select2"
      ],
      "public_html/vendor/moment": [
        "moment/moment"
      ],
      "public_html/vendor/jquery-tinysort": [
        "Sjeiti/TinySort"
      ],
      "public_html/vendor/pnotify": [
        "sciactive/pnotify"
      ],
      "public_html/vendor/history.js": [
        "browserstate/history.js"
      ],
      "public_html/vendor/jquery-tablesorter": [
        "mottie/tablesorter"
      ],
      "public_html/vendor/flot-rangeselect": [
        "uni-tel/flot-rangeselect"
      ],
      "public_html/vendor/flot-axislabels": [
        "markrcote/flot-axislabels"
      ],
      "public_html/vendor/bootstrap-fileinput": [
        "kartik-v/bootstrap-fileinput"
      ]
    }
  },
  "scripts": {
    "cs-source": "./vendor/bin/php-cs-fixer fix source -v --dry-run",
    "cs-source-fix": "./vendor/bin/php-cs-fixer fix source -v",
    "cs-lib": "./vendor/bin/php-cs-fixer fix lib  -v --dry-run",
    "cs-lib-fix": "./vendor/bin/php-cs-fixer fix lib -v",
    "cs-fix": "php -d max_execution_time=-1 ./vendor/bin/php-cs-fixer fix -v",
    "cs": "php -d max_execution_time=-1 ./vendor/bin/php-cs-fixer fix --dry-run -v",
    "symfony-scripts": [
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
    ],
    "post-install-cmd": [
      "@symfony-scripts"
    ],
    "post-update-cmd": [
      "@symfony-scripts"
    ]
  },
  "config": {
    "vendor-dir": "vendor",
    "component-dir": "public_html/vendor",
    "secure-http": false,
    "github-oauth": {
      "github.com": "4bafc46ecd8b6b169be8517537ac68adf6541a82"
    },
    "sort-packages": true
  },
  "autoload": {
    "psr-4": {
      "": "source/",
      "dbi\\": "lib/common/classes/database/",
      "exception\\": "lib/common/classes/exception/",
      "gui\\": "lib/www/gui/",
      "hl7\\": "lib/common/classes/hl7/",
      "lib\\": "lib/",
      "pageHandler\\": "lib/www/pagehandler/",
      "template\\": "lib/www/template/",
      "tests\\": "tests/",
      "Tree\\": "lib/common/classes/Tree/",
      "user\\": "lib/common/classes/user/",
      "view\\": "lib/views/"
    },
    "classmap": [
      "app/AppKernel.php",
      "app/AppCache.php",
      "app/KernelRouter.php",
      "app/ConsoleApplication.php",
      "app/Service/KernelRouteRelation.php"
    ]
  }
}

Maybe some expert can see immediately what's the problem? From what I can see php-cs fixer is compatible with Symfony 5.4 as well as PHP 8.2.


Solution

  • Here the correct steps to fix the issue:

    composer cc
    rm -rf vendor/
    rm composer.lock
    composer install
    composer require friendsofphp/php-cs-fixer --dev
    

    Rebuilding the composer.lock and running composer require without -W did the trick. I suppose the lock file was broken after some git merging.