After the update, the PHP-CS-Fixer stopped working.
how to solve a problem?
Same problem here.
Atom version 1.18.0
Win 10 x64
I have...
@9585999 Are you find solution?
Facing same issue after update.
Using windows. Already set path via settings. However,
Error: Could not find 'php-cs-fixer'. The program may not be installed.
Hi everyone! I want to help solve this for you ASAP. The last release was specifically targeting improving the setup of third-party beautifiers (e.g. PHP-CS-Fixer) within Atom-Beautify. While all of my tests passed, I know this is a complicated matter and I need help for users like you to really make this experience great.
Please provide:
debug.md Gist (see https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md for help)php-cs-fixer works manually from your Shell / Terminal. I suspect it has, since it was previously working, just want to double-check.PHP-CS-Fixer executable. Try which php-cs-fixer on Mac/Linux and where php-cs-fixer on Windows.In the mean time, you could downgrade to the last release with apm install [email protected]. This issue is my top priority so expect release v0.30.1 soon! Thank you all for your patience!
Published patch to v0.30.1
Please provide the above information if the latest release does not improve things for you. Thanks!
For anyone experiencing this issue please provide the information I requested in https://github.com/Glavin001/atom-beautify/issues/1725#issuecomment-309316988
I hope to resolve this very soon. However, I have been unable to reproduce these issues -- it works on my machine 馃檮 -- so I need some more data to work with. Thank you all for your patience!
At me all works, now even in options atom-beatufy I do not register a way to php-cs-fixer.
Thanks for your work !
Work on my Win 10x64. Tnx Glavin001.
PHPCBF was working perfectly recently until this happened in the new version, hope this gist is helpful for you to debug. Also tried adding the executables with no luck.
gist
Thanks for your hard work
Thanks, @prasadfutballer !
From your logs:
2017-06-19T08:17:11.568Z - debug: [] spawn done 0 PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)
2017-06-19T08:17:11.569Z - verbose: [] spawn result, returnCode 0
2017-06-19T08:17:11.569Z - verbose: [] spawn result, stdout PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)
2017-06-19T08:17:11.569Z - verbose: [] spawn result, stderr
2017-06-19T08:17:11.569Z - info: [] Version text: PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)
2017-06-19T08:17:11.569Z - error: [] Error: Version is not valid: null
at /home/mindset/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:96:21
Note when phpcbf --version is run the response is PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net). This is not being correctly handled at https://github.com/Glavin001/atom-beautify/blob/908b53cba8df5eecc8cede64a29c130cdc704e4c/src/beautifiers/phpcbf.coffee#L18 . By default (which is how it currently is configured) it will expect the response to be exactly 3.0.1.
This should be a quick fix I will have to test out tomorrow and publish a new release. Until then, please downgrade so you can still be productive and I will fix this ASAP. Thanks!
No problem @Glavin001 ..Just to help you out I just updated PHPcodesniffer to 3.0.1 after this error occurred just to check out if that solves the problem. I previously had PHP_Codesniffer v2.6.0 with the same error.
Thank you :)
Hi guys,
Ran the latest package update today (v 0.30.1) and having the same issue as what's been described above.
@Glavin001, here's the gist for my debug.md - hope it helps - https://gist.github.com/zesda/b39f127dcafe00a24128c1c406dac483
Just installed. Same issue v 0.30.1
Having this issue:
the "PHP - PHP-CS-Fixer Path (cs_fixer_path)" configuration option has been deprecated. Please switch to using the option named "Executables - PHP-CS-Fixer - Path" in Atom-Beautify package settings now.
Using Windows 10 64x, path of "which php-cs-fixer" exactly matches with atom beautify path required.
The path in atom beautify that I have placed ends with C:/php-cs-fixer.phar
from command line running php C:/php-cs-fixer.phar shows the available commands.
Not too sure what the error meant.
@nicholas-ooi Try removing the php-cs-fixer path from the atom-beautify settings
@nicholas-ooi : @9585999 is correct. I will be removing the PHP - PHP-CS-Fixer Path configuration option later, in favour of the standardized and consistent "Executables" configuration options. Simply deleting the old entry (making it falsy) will remove this deprecation warning. See https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/php-cs-fixer.coffee#L92-L94 for applicable code.
@prasadfutballer would you be able to create a new issue with your info for specifically PHP CodeSniffer (PHPCBF)? Since PHP-CS-Fixer and PHPCBF will be different fixes. I'll try to fix it up tonight after work. Thanks!
Thank you everyone else for your debug.md. Keep them coming! I'm hoping by using a more consistent method -- i.e. the new Executables feature -- we will be able to finally polish off the workflow for setting up external beautifiers.
Thanks for the clarification really appreciate it.
However, I removed the path. It threw me an error "Could not find 'php-cs-fixer'. The program may not be installed."
I tested "where.exe php-cs-fixer" and it gave me the absolute path.
I have also placed the relevant path in the ENV variable but still encountered same issue, since i tried to also shift the php-cs-fixer.phar in different folders. I know that the ENV works because I could type php-cs-fixer.phar in the command and it will launch it in my editor knowing that the path has been set.
Furthermore, in the command line I was still able to execute php php-cs-fixer fix etc. by changing directory to where php-cs-fixer.phar is located.
However, I removed the path. It threw me an error "Could not find 'php-cs-fixer'. The program may not be installed."
I think you may still need it manually configured, just using the Executables - PHP-CS-Fixer - Path configuration option instead of PHP - PHP-CS-Fixer Path. Go into Atom's Package settings -> Atom-Beautify -> expand Executables section -> expand PHP-CS-Fixer -> set the Path option. This will accomplish the same this as the old PHP - PHP-CS-Fixer Path option except in the standardized Executables configuration section. Hope that helps!
@nicholas-ooi You have an atom installed php-cs-fixer?
I had an atom php-cs-fixer installed long time ago but I had it uninstall immediately after I discovered beautify, which had been using for a couple of months.
@Glavin001 Alright will try it out! and thanks!
@zesda the version of PHP you are using was unsupported:
2017-06-19T08:53:37.785Z - info: [] Version text: PHP 7.1.0beta3 (cli) (built: Aug 20 2016 09:51:26) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies2017-06-19T08:53:37.785Z - error: [] Error: Version is not valid: 7.1.0beta3
I will improve the version parsing to support 7.1.0beta3 as well. Thanks for your debug.md Gist!
@johanvanhelden and @kataklys from https://github.com/Glavin001/atom-beautify/issues/1727 :
Please follow the issue template provided. More specifically, adding a link to the required
debug.mdGist which includes debugging information that answers our most commonly asked questions.
Thank you.
Hopefully the fix for @zesda will work for you, however without each of your debug.md Gist links I can do nothing to fix your problem for certain.
Published fixes to v0.30.2
@Glavin001 6db34cd fixed it for me, thanks!
I'm still confused. I'm on Windows 10 inside of .atom/packages/php-cs-fixer. What file am I looking for here? I can't find any .phar files. There's an .editorconfig file, but then I get Spawn Unknown error. There's a .coffee file in lib, but same issue when I link to that. There's a .php_cs file in the examples folder, and when I run atom beautify I no longer get any error, but it also does not appear to be working.
Stays ugly (white spaces) after running the beautifier.
I'm on Windows 10 inside of .atom/packages/php-cs-fixer.
@jordan-webdev, it sounds like you're talking about the package https://atom.io/packages/php-cs-fixer not Atom-Beautify. If you are talking about Atom-Beautify then:
Please follow the issue template provided. More specifically, adding a link to the required
debug.mdGist which includes debugging information that answers our most commonly asked questions.
Thank you.
Yes, I'm talking about php-cs-fixer, but I'm using Atom beautify. I'm trying to update my path like this thread mentions, but I can't seem to find the right value to input in that field.
The debug.md Gist I mentioned above, which can easily be automatically generated, helps show me where potential problems are. Once you have provided it we can discuss further.
Also take a look at the Beautifiers section in the README: https://github.com/Glavin001/atom-beautify#beautifiers
The row for PHP-CS-Fixer provides installation instructions, if you have not already seen.
Okay, I installed the .phar file from there now and linked to it in the path. Now when I run atom beautify, there is no error, but it does not work. Notice how there is no space between the opening php tag and the if statement in "if (is_front_page()"? I tried closing and reopening atom editor.
https://gist.github.com/jordan-webdev/6938bb592335c379c99ecf5328904762
Your logs show:
2017-06-21T14:47:19.319Z - debug: [] spawn C:\Program Files (x86)\iis express\PHP\v7.1\php.EXE 0=C:\Users\LPAS00007316\.atom\packages\php-cs-fixer\php-cs-fixer-v2.phar, 1=fix, 2=--allow-risky=no, 3=--using-cache=no, 4=C:\Users\LPAS00~1\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php
2017-06-21T14:47:19.554Z - debug: [] spawn done 0 Loaded config default.
Files that were not fixed due to errors reported during linting before fixing:
1) C:\Users\LPAS00007316\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php
Fixed all files in 0.006 seconds, 6.000 MB memory used
2017-06-21T14:47:19.554Z - verbose: [] spawn result, returnCode 0
2017-06-21T14:47:19.554Z - verbose: [] spawn result, stdout
Fixed all files in 0.006 seconds, 6.000 MB memory used
2017-06-21T14:47:19.554Z - verbose: [] spawn result, stderr Loaded config default.
Files that were not fixed due to errors reported during linting before fixing:
1) C:\Users\LPAS00007316\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php
Looks like a linting error in your code prevented PHP-CS-Fixer form working. If you have questions I recommend you ask them at https://github.com/FriendsOfPHP/PHP-CS-Fixer
Most helpful comment
I had an atom php-cs-fixer installed long time ago but I had it uninstall immediately after I discovered beautify, which had been using for a couple of months.
@Glavin001 Alright will try it out! and thanks!