Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using PHPCS with Sublime Text

Sử dụng PHP-Code-Sniffer kiểm tra code convention với Sublime Text

  1. Cài đặt PHP-Code-Sniffer

    composer global require "squizlabs/php_codesniffer=*"
  2. Thêm bộ quy tắc Framgia PHP https://github.com/wataridori/framgia-php-codesniffer

  3. Cài đặt Sublime Text package https://packagecontrol.io/packages/Phpcs.

    Cấu hình: Preferences => Package Settings => PHP Code Sniffer => Settings User

    {
    	"phpcs_executable_path": "ABSOLUTE_PATH_OF_phpcs",
    	"phpcs_additional_args": {
            "--standard": "Framgia",
            "-n": ""
        },
    }
  4. Other Sublime Text setting

    {
        // End of file is always newline
    	"ensure_newline_at_eof_on_save": true,
    	// Using space
    	"translate_tabs_to_spaces": true,
    	// Strip whitespace
    	"trim_trailing_white_space_on_save": true
    	"rulers":
    	[
    		80, // Soft limit
    		120 // Hard limit
    	],
    	"indent_guide_options":
    	[
    		"draw_normal",
    		"draw_active"
    	],
    	"show_encoding": true,
    	"show_line_endings": true,
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.