For configuration or updating questions please read the README and UPGRADE documentation,
or visit: https://gitter.im/PHP-CS-Fixer
When reporting an issue (bug) please provide the following information:
The PHP version you are using:
$ php -v
PHP 7.1.11-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Oct 27 2017 13:49:56) ( NTS )
PHP CS Fixer version you are using:
$ php-cs-fixer -V
PHP CS Fixer 2.8.0 Round Numbers by Fabien Potencier and Dariusz Ruminski
The command you use to run the fixer (and the configuration file you are using if any).
./vendor/bin/php-cs-fixer fix --verbose
Hello,
I've updated an old project to phpcsfixer v2 and its configuration.
However, when running the phpcsfixer fix command, it's not doing anything and is stuck on:
You are running PHP CS Fixer with xdebug enabled. This has a major impact on runtime performance.
If you need help while solving warnings, ask at https://gitter.im/PHP-CS-Fixer, we will help you!
Loaded config default from "/Users/nicolaswidart/Sites/Freelance/projectname/website/.php_cs.dist".
When I run it on a specific file, it's working:
./vendor/bin/php-cs-fixer fix app/User.php
This same configuration file is working for other projects though, so I'm not sure why it's not here.
Did I miss something?
Thanks,
Hi,
Do you have a file with a lot of (anonymous) class definitions in it? That is the only performance issue we know of ATM. Might be hard to track down, but could you try fixing (--dry-run) different directories to see if you can isolate on which file the fixer hangs?
Could it also be that you are running it for the whole project, including the vendor?
Normally I directly tell it to run on ./tests and ./src to avoid it running on folders I don't want to.
It's also not running when I run it on the app/ folder only.
It's running for the whole project, but as you can see from the config file, a lot of folders are excluded like vendor, node_modules, etc.
There are indeed anonymous classes, trying to search where those are.
@nWidart
is it possible to somehow share access to project that error happen on ? (maybe it;s on github?)
that would really help us investigate what's going on, as lack of any CLI output is not helpful for debugging/fixing :(
(if it is not public but you are willing to share it temporary - please contact me directly)
@SpacePossum , anonymous classes are not the reason IMO, as we shall still start displaying progress indicator, and fixing single file, even with a lot of anonymous class, wont take minutes.
Sadly, closing due to lack of @nWidart presence
Well the issue is still present.
I cannot provide access to the repository as it's a private client project sadly.
oh, you are alive!
without any way to reproduce you are sadly on your own. if we cannot experience the issue, there is not much help we could provide. try to shrink down the issue to minimal case that you would be able to share. or consider granting temporary access to one of us as external experts.
also, upgrade to 2.8.1 and try out PHP_CS_FIXER_FUTURE_MODE=1 php-cs-fixer fix -vvv.
If it won't provide more details and you won't be able to shrink down the case to shareable one, try to debug FixCommand.php file to see in which moment it is freezing.
@keradus I think I have a similar issue. I let php-cs-fixer run on a file tree, and it progresses rapidly for a while and then it just gets stuck. I managed to figure out at least one file where it gets stuck. Unfortuantely, I can't share it. But the file is basically the export of a DB table in PHP array format. It's about 1400 lines with a structure like this:
$t_user = array(
array('id' => '1','m_nr' => '7','status' => 'XXX','nachname' => 'XXX','vorname' => 'XXX','titel' => '','jahrgang' => 'XXX','ans_p' => 'XXX','ort_p' => 'XXX','land_p' => '','tel_p' => '','fax_p' => '','email_p' => 'XXX','firma' => 'XXX','ans_g' => '','ort_g' => 'XXX','land_g' => '','tel_g' => 'XXX','fax_g' => '','email_g' => 'XXX','username' => 'XXX','passwort' => 'XXX','geb' => 'XXX','mobil_p' => '','mobil_g' => '','abt_g' => '','pos_g' => 'XXX','branche_g' => '','hp_p' => '','hp_g' => 'XXX','prakt_firma' => 'XXX','prakt_abt' => '','prakt_bran' => 'XXX','prakt_ans' => 'XXX','prakt_ort' => 'XXX','prakt_tel' => 'XXX','prakt_hp' => 'XXX','prakt_auf' => '','prakt_tip' => '','dipl_stuhl' => 'XXX','dipl_thema' => 'XXX','dipl_betr' => 'XXX','dipl_tip' => '','ausl_uni' => 'XXX','ausl_ort' => 'XXX','ausl_land' => 'XXX','ausl_sem' => 'XXX','ausl_hp' => '','ausl_tip' => '','st_beginn' => 'XXX','ts' => 'XXX','gebname' => NULL),
/* and so on..*/
);
This is the command I'm running:
php-cs-fixer fix -vvv --rules=no_spaces_after_function_name,elseif,braces,encoding,full_opening_tag,single_blank_line_at_eof,function_declaration,line_ending,method_argument_space,no_trailing_whitespace_in_comment,no_closing_tag,switch_case_semicolon_to_colon,switch_case_space,no_trailing_whitespace,whitespace_after_comma_in_array,whitespace_after_comma_in_array,no_whitespace_before_comma_in_array,no_empty_statement file.php
I let it run on this single file for something like 10mins on a Xeon E5-1620 3.5GHz machine. In top I see a PHP process that takes 100% CPU during that time and something like 200MB memory. I stopped with Ctrl-C after a while, because nothing was happening. Does this help?
P.S.: I would be very nice if -vvv would print out the filename it's currently processing, that would make it a lot easier to see where it chokes
@flack , please raise a new issue following the template - and for the example file you found problems with, simply anonymise the data, without example file, one won't be able to reproduce.
PS go ahead and create a proposal for 2.12 branch
@keradus I'm not exactly sure how to (non-manually) anonymize the data without destroying the wacky formatting that the file has (because I guess that's a factor here), but I'll take a look. If I find a way, I'll open a new ticket
@keradus filed as #3996
Most helpful comment
@keradus filed as #3996