Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added setting for PHP executable path #16

Closed
wants to merge 4 commits into from

2 participants

@dprevite

I added phpcs_php_path as an option to set the path to PHP. Helpful if you have multiple versions of PHP installed or if it's not set in the path correctly.

@benmatselby benmatselby referenced this pull request from a commit
@benmatselby Updated Changelog for GH-16 2f44fb9
@benmatselby
Owner

Hi Dan

I rebased your changes into one commit and it's now merged in.. Thanks for this contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 28, 2012
  1. @dprevite

    Added PHP path setting

    dprevite authored
  2. @dprevite
  3. @dprevite

    Updated docs

    dprevite authored
  4. @dprevite

    Removed testing path

    dprevite authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +1 −0  README.md
  2. +7 −1 phpcs.py
  3. +2 −0  phpcs.sublime-settings
View
1  README.md
@@ -33,6 +33,7 @@ Configuration
You can configure:
+* phpmd_executable_path - The path to the PHP executable. If empty string, use PATH to find it
* phpcs_additional_args - This is the extra information you want to pass to the phpcs command. For example which “standard” you want to run, and if you want to show warnings or not
* phpcs_execute_on_save - Do you want the code sniffer plugin to run on file save for php files?
* phpcs_show_gutter_marks - Do you want the errors to be displayed in the gutter?
View
8 phpcs.py
@@ -14,6 +14,7 @@
class Pref:
@staticmethod
def load():
+ Pref.phpcs_php_path = settings.get('phpcs_php_path', '')
Pref.phpcs_additional_args = settings.get('phpcs_additional_args', {})
Pref.phpcs_execute_on_save = bool(settings.get('phpcs_execute_on_save'))
Pref.phpcs_show_errors_on_save = bool(settings.get('phpcs_show_errors_on_save'))
@@ -30,6 +31,7 @@ def load():
Pref.load()
[settings.add_on_change(setting, Pref.load) for setting in [
+ 'phpcs_php_path',
'phpcs_additional_args',
'phpcs_execute_on_save',
'phpcs_show_errors_on_save',
@@ -162,7 +164,11 @@ def execute(self, path):
if Pref.phpcs_linter_run != True:
return
- args = ["php"]
+ if Pref.phpcs_php_path != "":
+ args = [Pref.phpcs_php_path]
+ else:
+ args = ['php']
+
args.append("-l")
args.append("-d display_errors=On")
args.append(os.path.normpath(path))
View
2  phpcs.sublime-settings
@@ -3,6 +3,8 @@
// If empty, then use PATH version of phpcs, else use the set value
"phpcs_executable_path": "",
+ "phpcs_php_path": "",
+
// Additional arguments you can specify into the application
//
// Example:
Something went wrong with that request. Please try again.