Cannot update to PHP 7.3 due to friendsofphp/php-cs-fixer requirements

Hi Craig & Digitalstrartup community,

At first A HAPPY NEW YEAR TO ALL OF YOU GUYS pulling your hair enjoying Magento.

Craig in recent days I tried to upgrade my PHP to 7.3. I followed this posts, The process was pretty simple. Copy and paste your command :slight_smile: using a superuser.

I haven’t spotted any issues during the upgrade. Then I upgraded one of my Amnasty modules. When I run the bin/magento setup:upgrade command the following warring message was shown.

The error doesn’t look to be related to Amnasty extension. Maybe the friendsofphp/php-cs-fixer v2.13.3 is Magento itself related? :thinking:

I never installed it.
Can you give me a tip on how to fix it?
Check what this is responsible for? I’m guessing that I should upgrade the frindsofphp/php-cs-fixer to a newer version which is compatible with php7.3 and than upgrade my php.

(I forgot to mention that prior to the upgrade I contacted all my 3rd party module releasers and asked them if their modules are compatible with PHP 7.3. All confirmed that their products are compatible with PHP 7.3)

Thank you.

I found something about it here:

I’m guessing it is a part of my composer. So if I run this command:

composer require friendsofphp/php-cs-fixer

It should upgrade my version for 2.13.3 to 2.16.1.

Happy New Year ::tada::

I’m pretty sure that friendsofphp/php-cs-fixer is a Magento dependency as I’ve found the same entry in my composer.json file in both my 2.2.x and 2.3.x installations. It’s used to automatically fix PHP Coding Standards issues.

The latest stable version is 2.16.1 released back in November. So, you might want to try updating that, as your version of 2.13.3 was released back in April. Once that blocker is out the way then you should be good to go.

Normally when a “blocker” appears like this, it’s because a “lock” has been put on the version. Something that I briefly touched on in this post entry: Error: "Unable to unserialize value" during composer update - #8 by digitalstartup.

I suspect your version of friendsofphp/php-cs-fixer is locked to the 2.13.x branch. Therefore, you might have to specify the version number when you run the composer require command for it.

Side Note: I wrote this reply before reading your other post… You got to the same conclusion :+1:

1 Like

Thank you very much.

I recently ran into this issue myself. Here’s what I learned…

  • friendsofphp/php-cs-fixer is a package used for development, so is not necessary required in a production environment.
  • For whatever reason, Magento might not have updated your composer.json file with the appropriate version changes in previous updates.
  • You cannot simply update this to the latest version as other dependency modules will then fail.

Having learned this, I came up with the following solution that appears to work in limited testing that I did.

So, in the latest GitHub Repo (2.3.6), the composer.json file contains the correct "require-dev" modules and version numbers. So, go ahead and copy/replace that block with whatever you have in your own "require-dev" block in your composer.json file.

Extract taken from Magento 2.3.6 GitHub Repo.

    "require-dev": {
        "allure-framework/allure-phpunit": "~1.2.0",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
        "friendsofphp/php-cs-fixer": "~2.14.0",
        "lusitanian/oauth": "~0.8.10",
        "magento/magento-coding-standard": "*",
        "magento/magento2-functional-testing-framework": "~2.6.5",
        "pdepend/pdepend": "2.5.2",
        "phpcompatibility/php-compatibility": "^9.3",
        "phpmd/phpmd": "@stable",
        "phpstan/phpstan": "^0.12.2",
        "phpunit/phpunit": "~6.5.0",
        "sebastian/phpcpd": "~3.0.0",
        "squizlabs/php_codesniffer": "~3.4.0"

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.