Sublime Text 3 phpcs 配置

本文介绍了一个针对Windows 7系统的PHP开发环境配置示例,包括PHP_CodeSniffer、PHP-CS-Fixer及PHP Linter等工具的具体设置,以实现代码规范检查、格式美化及语法错误检测等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

具体下载地址看这个 http://my.oschina.net/qsmoon/blog/280813

,我只是单纯的帖一下自己配置作为备份


{
    // Example for:
    // - Windows 7
    // - With phpcs and php-cs-fixer support
    // We want debugging on
    "show_debug": true,
    // Only execute the plugin for php files
    "extensions_to_execute": ["php"],
    // Do not execute for twig files
    "extensions_to_blacklist": ["twig.php"],
    // Execute the sniffer on file save
    "phpcs_execute_on_save": true,
    // Show the error list after save.
    "phpcs_show_errors_on_save": true,
    // Show the errors in the gutter
    "phpcs_show_gutter_marks": true,
    // Show outline for errors
    "phpcs_outline_for_errors": true,
    // Show the errors in the status bar
    "phpcs_show_errors_in_status": true,
    // Show the errors in the quick panel so you can then goto line
    "phpcs_show_quick_panel": true,
    // Path to php on windows installation
    // This is needed as we cannot run phars on windows, so we run it through php
    "phpcs_php_prefix_path": "D:\\program files\\wamp\\bin\\php\\php5.4.12\\php.exe",
    // We want the fixer to be run through the php application
    "phpcs_commands_to_php_prefix": ["Fixer"],
    // PHP_CodeSniffer settings
    // Yes, run the phpcs command
    "phpcs_sniffer_run": true,
    // And execute it on save
    "phpcs_command_on_save": true,
    // This is the path to the bat file when we installed PHP_CodeSniffer
    "phpcs_executable_path": "D:\\program files\\wamp\\bin\\php\\php5.4.12\\phpcs.bat",
    // I want to run the PSR2 standard, and ignore warnings
    "phpcs_additional_args": {
        "--standard": "PSR2",
        "-n": ""
    },
    // PHP-CS-Fixer settings
    // Don't want to auto fix issue with php-cs-fixer
    "php_cs_fixer_on_save": false,
    // Show the quick panel
    "php_cs_fixer_show_quick_panel": true,
    // The fixer phar file is stored here:
    "php_cs_fixer_executable_path": "D:\\program files\\wamp\\bin\\php\\php5.4.12\\php-cs-fixer.phar",
    // Additional arguments, run all levels of fixing
    "php_cs_fixer_additional_args": {
        "--level": "all"
    },
    // PHP Linter settings
    // Yes, lets lint the files
    "phpcs_linter_run": true,
    // And execute that on each file when saved (php only as per extensions_to_execute)
    "phpcs_linter_command_on_save": true,
    // Path to php
    "phpcs_php_path": "D:\\program files\\wamp\\bin\\php\\php5.4.12\\php.exe",
    // This is the regex format of the errors
    "phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)",
    // PHP Mess Detector settings
    // Not turning on the mess detector here
    "phpmd_run": false,
    "phpmd_command_on_save": false,
    "phpmd_executable_path": "",
    "phpmd_additional_args": {}
}


转载于:https://my.oschina.net/u/130139/blog/290638

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值