akalongman / sublimetext-codeformatter

Code Formatter plugin for ST2/ST3
MIT License
772 stars 130 forks source link

mac os x php error message!!! #390

Closed JieAnthony closed 5 years ago

JieAnthony commented 5 years ago

`CodeFormatter

Format error:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php on line 5386

Call Stack: 0.0020 461544 1. {main}() /Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar:0 0.0188 3930080 2. include('phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php') /Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar:9 0.0195 3957624 3. CodeFormatter->formatCode() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php:13566 0.0199 3968864 4. TwoCommandsInSameLine->format() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php:2790 0.0199 4035784 5. each() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/`

I would like to ask how to solve it,thank you

jeraldpunx commented 5 years ago

how?

alexkuc commented 5 years ago

PHP 5.5 alone is at least 3 years EOL (source) so "downgrading" to that is most likely a bad idea. each() is deprecated since version 7.2.0. I am on OSX 10.13.6 which ships with PHP version 7.1.23 so using a built-in php is a good workaround. Check your $PATH to make to make sure you don't override default php path (can be also checked via which php).

EDIT: while your $PATH can use <7.2.0, you can alias a newer PHP which you can use from the interactive shell while maintaining backwards compatibility with cli tools. As an example:

alias php='/Applications/MAMP/bin/php/php7.2.14/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.14.ini"'
saurabh-cimpress commented 5 years ago

I am also facing the same issue with PHP 7.3.11 on Mac OS 10.15.1 on Sublime Text 3 build 3211. Any help for this issue is highly appreciated.