##问题描述
sublime text 3使用Ctrl+Alt+f快捷键对代码格式化的时候报错如下:
CodeFomatter
Format error:
PHP Deprecated: The each() function is deprecated.This message will be suppressed on further calls in phar://D:/Program Files/Sublime Text 3 /Data/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php on lin 5386
##分析:
经过网上查找得知,是因为使用的php版本的问题,我本地使用的7.2版本的,7.2版本废弃了each方法,但是codeformatter中却还在使用这个方法,所以就会报错。
##解决:
将CodeFromatter配置中php_path
使用的php.exe版本改为低版本的即可。(我本地正常使用的是7.2版本的,但是配置里面使用的是7.0的)
{
"codeformatter_debug": false,
"codeformatter_php_options":
{
"syntaxes": "php", // Syntax names which must process PHP formatter
"php_path": "D: