-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid file syntax error for php-cs-fixer on a valid php file #140
Comments
Can you provide more context from the log please in the console, and also supply your phpcs settings. |
Hello, Here's the full log
and this is my config {
"show_debug": true,
"phpcs_executable_path": "/Applications/MAMP/bin/php/php5.5.18/bin/phpcs",
"php_cs_fixer_on_save": true,
"phpcs_execute_on_save": true,
"php_cs_fixer_executable_path": "/Users/moonkuykyong/.composer/vendor/bin/php-cs-fixer",
"phpcs_php_path": "/Applications/MAMP/bin/php/php5.5.18/bin/php",
"phpcs_show_quick_panel": false,
"phpcs_show_errors_on_save": true,
}
|
I'm a little stumped here as this is working for me:
What version of php-ca-fixer are you using? I'm using 1.9 |
Is this Sublime Text 3 btw? |
Same here. It's been working just fine for me. It just stopped working a few days ago. I'm using php-cs-fixer 1.9 and I'm on Sublime Text 3. It works just fine from the terminal. |
Hi @moon0326 Anything to do with the double / in the path? Also, it's nothing related to line endings or the encoding of the file is it? |
@benmatselby That's my mistake. There was a dir name between / and /. I removed it since it's a company project. In the actual log, the path is correct. I don't think it has anything to do with file encoding since it works when I run the exact command (copy and paste) from the terminal manually. |
I think I've figured out what is wrong here. This happens when your PHP file contains newer PHP syntax than what's available in the version of PHP that I've tried to append the full path to my PHP 5.6 install in the configuration ( |
@reinink You can do this already by setting the If you define the array in there, it will then prefix the PHP path to it. |
Hey Ben, thanks, but it's still not working. Are you sure it adds it to the
What I'm looking for is:
Any ideas? |
Just checked on my install (at a machine now). You need to define
In your config. This is on Line 250 of the plugin Just ran this on my machine:
|
@reinink Did this resolve it for you? |
Yes and no. Been meaning to do more testing, but haven't had a chance yet. It did in fact add "/usr/local/opt/php55/bin/php" before the command, which is what I wanted. But, much to my disappointment, it did not resolve the original issue. So now I'm really puzzled. Only thing I can think is that simple putting "/usr/local/opt/php55/bin/php" before the "php-cs-fixer" may not actually make php-cs-fixer run on that version of PHP. So yeah, more testing required yet. |
I have the same issue in ST3, using php and php-cs-fixer binaries installed by Homebrew on OS X. Initial problem:
The same command run from the command line finishes without any problem. After prepending php settings as suggested:
Some more info
|
I too have this exact same issue. When I call the fixer from Sublime Text 3, I get a
And when I paste the exact same command [Phpcs] gave me on console, only adding some quotes to admit the spaces on the path, like:
What do I need to provide in order to help solving this? |
From "159 closed : So I changed to Then after running php cs fixer, I get that in the console 👍
And that's all. Nothing happens. Looking forward to hearing from you, Regards |
Hi,
I noticed my php-cs-fixer stopped working. I've enabled show_debug and looked at the log messages.
When I copy and paste the same command from the console to my terminal, it works just fine.
I've checked my php path and all the configurations and they look just fine.
Where should I look?
The text was updated successfully, but these errors were encountered: