You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-17Lines changed: 22 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
# PHP CodeSniffer and WordPress Coding Standards with VS Code
2
2
3
-
_Last Updated 2016-11-17 by @tommcfarlin_
3
+
_Last Updated 2020-07-31 by @tommcfarlin_
4
4
5
5
This guide is meant to provide all of the steps necessary to easily get up and running with PHP CodeSniffer, the WordPress Coding Standard ruleset, and Visual Studio Code.
6
6
7
-

7
+

8
8
9
9
All of the resources used in this guide are linked at the bottom. This guide is also licensed [MIT](https://github.com/tommcfarlin/phpcs-wpcs-vscode/blob/master/LICENSE). If you'd like to contribute, then please feel free to open issues or issue pull requests. I'll be happy to merge them and also add your username to [CONTRIBUTING](https://github.com/tommcfarlin/phpcs-wpcs-vscode/blob/master/CONTRIBUTING.md).
10
10
11
-
If you're looking for a corresponding blog post, please see [this page](https://tommcfarlin.com/php-codesniffer-in-visual-studio-code).
11
+
If you're looking for corresponding blog posts, please see:
12
+
1.[Setting Up PHP CodeSniffer in Visual Studio Code](https://tommcfarlin.com/php-codesniffer-in-visual-studio-code)
13
+
2.[Setting Up PHP CodeSniffer Per Project](https://tommcfarlin.com/php-codesniffer-per-project/)
12
14
13
15
As always, don't forget to checkout the [CHANGELOG](https://github.com/tommcfarlin/phpcs-wpcs-vscode/blob/master/CHANGELOG.md) to track everything that's changed since the initial release of this guide.
with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
35
+
with Zend OPcache v7.4.7, Copyright (c), by Zend Technologies
32
36
```
33
37
34
-
If you're looking for how to use a different version of PHP installed elsewhere on your system,
35
-
this is not the guide for that. If, however, you're curious as to _where_ the version of PHP you're
36
-
using is stored, you can enter:
38
+
If you're looking for how to use a different version of PHP installed elsewhere on your system, this is not the guide for that. If, however, you're curious as to _where_ the version of PHP you're using is stored, you can enter:
37
39
38
40
```
39
41
$ which php
@@ -42,15 +44,14 @@ $ which php
42
44
And you should see something similar to this:
43
45
44
46
```
45
-
/usr/bin/php
47
+
/usr/local/bin/php
46
48
```
47
49
48
50
That should give you enough information for the rest of this guide.
49
51
50
52
## 2. Installing Composer
51
53
52
-
Installing Composer globally means that you'll be able to access it from anywhere on your system (that is, in any directory regardless of where you are). To do this, you can read the [manual](https://getcomposer.org/doc/00-intro.md) or follow the quick steps below (which summarize the
53
-
manual, anyway):
54
+
Installing Composer globally means that you'll be able to access it from anywhere on your system (that is, in any directory regardless of where you are). To do this, you can read the [manual](https://getcomposer.org/doc/00-intro.md) or follow the quick steps below (which summarize the manual, anyway):
54
55
55
56
1. Grab [the latest snapshot](https://getcomposer.org/composer.phar) of Composer. Save it somewhere you'll remember.
56
57
2. Move the file you just downloaded to the `/usr/local/bin/` directory on your machine.
@@ -84,16 +85,16 @@ For the purposes of this document, we're installing PHP CodeSniffer on a project
84
85
From the integrated terminal within Visual Studio Code, enter the following command:
This will create `composer.json`, tell it where to locate the PHP CodeSniffer, and install it in a `vendor` directory. Once this is done, we need the WordPress Coding Standard ruleset.
91
92
92
93
## 4. Installing the WordPress Coding Standards Rules
93
94
94
-
I recommend placing the rules in a directory you can refer to often. Personally, I use a `projects` directory in my Dropbox directory to manage all of my work because it obviously provides backups automatically (and no, I don't recommend storing secure files there).
95
+
I recommend placing the rules in a directory you can refer to often. Personally, I use a `projects` directory to manage all of my work.
95
96
96
-
From within your directory of choice, say `dropbox/projects`, enter the following command in the terminal:
97
+
From within your directory of choice, say `/projects`, enter the following command in the terminal:
0 commit comments