WelcomeNewUsers
WelcomeNewUsers

Reputation: 257

php-cs-fixer stopped working after php 7.3 update

I'm using Homebrew to manage both of them and they are up to date.

~ $ brew --version
Homebrew 1.8.4
Homebrew/homebrew-core (git revision a166; last commit 2018-12-08)

~ $ php --version
PHP 7.3.0 (cli) (built: Dec  7 2018 11:00:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies

~ $ php-cs-fixer --version
PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.2.*.

~ $ brew upgrade php-cs-fixer
Error: php-cs-fixer 2.13.1 already installed

This happens when I try to use php-cs-fixer

~ $ php-cs-fixer fix file.php
PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.2.*.

So, I downloaded [email protected] and php-cs-fixer.phar to test and it works that way.

~ $ /usr/local/Cellar/[email protected]/7.2.13/bin/php /Users/aaronk/php-cs-fixer.phar fix file.php
Loaded config default from "/Users/aaronk/.php_cs".
Using cache file ".php_cs.cache".
Paths from configuration file have been overridden by paths provided as command arguments.
   1) file.php

Fixed all files in 0.014 seconds, 10.000 MB memory used
~ $

So my question is, how do I get homebrew's php-cs-fixer to work? Is homebrew doing something wrong here?

(p.s. is there a tag for php7.3)

Upvotes: 5

Views: 5772

Answers (5)

Ortomala Lokni
Ortomala Lokni

Reputation: 62466

As said by godbout, PHP-CS-Fixer does not yes support PHP 7.3. You can track the GitHub issue [Meta] PHP 7.3 support #3697, to follow the evolution of the situation. According to this issue, the following changes in PHP 7.3 still need to be adressed:

Upvotes: 4

Ermand Duro
Ermand Duro

Reputation: 31

The current version "friendsofphp/php-cs-fixer": "^2.14" now supports php 7.3. You could upgrade it and it should work fine.

Upvotes: 3

keradus
keradus

Reputation: 534

To clarify - PHP CS Fixer being run under PHP 7.3 may fix code written using syntax up to PHP 7.2. But if one would run tool on code written in 7.3, eg is_null($foo, ) (trailing comma), then behavior of fixer is not stable (producing null === $foo, - still, with trailing comma), which is an issue.

Upvotes: 0

Tomas Votruba
Tomas Votruba

Reputation: 24280

The mentioned issues isn't related to the PH PC Fixer code, rather to it's features. It's clear missuse of composer.json, where are dependencies, not features.

PHP CS Fixer works fine on PHP 7.3, see this PR.

This command allows you to install it on PHP 7.3:

composer update --ignore-platform-reqs

Let me know if you came across any troubles.

Upvotes: 0

godbout
godbout

Reputation: 1785

Nothing to do with Homebrew. It's php-cs-fixer itself that doesn't support PHP7.3. You would get the same issue through composer, with unmet dependencies.

Upvotes: 0

Related Questions