-
Notifications
You must be signed in to change notification settings - Fork 453
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
PHP beautifcation support #26
Comments
👍 |
@m1ga have you tried the PHP-Beautifier on it's own, from PIP? I just want to confirm that it works correctly, on it's own and as expected by yourself (a PHP user), before I go down that path. |
@Glavin001 yes I've tried (pear) PHP-Bautifier from the command line and it looks fine. Haven't had the time to look at the options yet but even with the standard settings it looks fine! |
Hah, pear. As you can see, I am not a PHP user myself 😉. |
Installing |
@m1ga could you give me a little sample snippet of PHP code, before and after beautification? So I can do some test. I am trying with: $t=date("H");
if ($t<"10") {
echo "Have a good morning!";
} elseif ($t<"20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
} However it does not change after beautifying.. Update: turns out you must have the |
sure
|
Thank you, @m1ga. On my Mac it is not working cleanly: $ php_beautifier --indent_spaces test.php test.php.out
PHP Strict Standards: Non-static method Console_Getopt::readPHPArgv() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 70
PHP Strict Standards: Non-static method Console_Getopt::getopt() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 84
PHP Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 92
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 109
PHP Strict Standards: Non-static method Console_Getopt::_parseLongOption() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 153
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/share/pear/Console/Getopt.php on line 154
PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /Users/glavin/pear/bin/php_beautifier on line 85 So instead of using stdout, have php_beautify pipe to file. Note: Use https://github.com/bruce/node-temp for creating temporary file that will receive output. |
I'm getting these warnings too but the test.php.out file looks good. |
Done and tested (on Mac). /cc @karolyi |
@m1ga for the time being, until @karolyi has reviewed the Pull Request, you can use my fork: # Clone fork repo
git clone [email protected]:Glavin001/atom-beautify.git
# Change into repo directory
cd atom-beautify/
# Install dependencies
npm install
# Uninstall old atom-beautify, if applicable
apm uninstall atom-beautify
# Link and use this atom-beautify
apm link
# Update dependencies
npm install
# Restart atom Let me know if there is anything else. |
I can't use php_beautifier cause of temporary file of current active session... I'm on Ubuntu 14.04 with php 5.6 and latest version of atom. All php_beautifier dependencies have installed and they're working correctly from terminal. Command failed: /bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bashrc ] && source ~/.bashrc;php "/usr/bin/php_beautifier " --input "/tmp/input115014-12433-1i2xoqb" --output "/tmp/115014-12433-1ke9sic" /bin/sh: 1: source: not found I've watched carefully "/tmp/" directory. But there's no file created during any session... How to solve this? |
@Batmandakh I have the same error. |
+1 same error with tmp files |
Sounds like for some reason The afflicting lines of code can be found at: https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee#L45-L50 If you can comment out those lines in your local installation of Atom Beautify, that should fix it. You will have to manually set the path of #164 will solve this. |
Whenever I try to use your package to beautify my php file it throws me this. spawn php ENOENT Is it because of wrong configuration? |
See https://github.com/sdwood/php-beautifier and https://github.com/SublimeText/PhpBeautifier and http://pear.php.net/package/PHP_Beautifier
The text was updated successfully, but these errors were encountered: