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: wiki/Configuration-Options.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
## Setting the default coding standard
9
9
10
-
By default, PHP_CodeSniffer will use the PEAR coding standard if no standard is supplied on the command line. You can change the default standard by setting the `default_standard` configuration option.
10
+
By default, PHP_CodeSniffer will use the PSR12 coding standard if no standard is supplied on the command line. You can change the default standard by setting the `default_standard` configuration option.
> This configuration option cannot be set using the `--runtime-set` command line argument. To set the coding standard for a single run only, use the `--standard` command line argument.
18
18
19
+
> [!NOTE]
20
+
> Prior to PHP_CodeSniffer 4.0.0, PHP_CodeSniffer would default to the PEAR coding standard.
21
+
19
22
<palign="right"><ahref="#table-of-contents">back to top</a></p>
Copy file name to clipboardExpand all lines: wiki/Home.md
+6-34Lines changed: 6 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,49 +6,21 @@ PHP_CodeSniffer is an essential development tool that ensures your code remains
6
6
7
7
A coding standard in PHP_CodeSniffer is a collection of sniff files. Each sniff file checks one part of the coding standard only. Each sniff can yield multiple error codes, a different one for each aspect of the code which was checked and found non-compliant.
8
8
9
-
Multiple coding standards can be used within PHP_CodeSniffer so that the one installation can be used across multiple projects. The default coding standard used by PHP_CodeSniffer is the PEAR coding standard.
9
+
Multiple coding standards can be used within PHP_CodeSniffer so that the one installation can be used across multiple projects.
10
+
As of PHP_CodeSniffer 4.0.0, the default coding standard used by PHP_CodeSniffer is the PSR12 coding standard (previously, this was the PEAR standard).
10
11
11
12
## Example
12
13
13
-
To check a file against the PEAR coding standard, simply specify the file's location.
14
+
To check a file against the PSR12 coding standard, simply specify the file's location.
Copy file name to clipboardExpand all lines: wiki/Usage.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Running PHP_CodeSniffer with the `-h` or `--help` command line arguments will pr
14
14
```
15
15
16
16
> [!NOTE]
17
-
> The `--standard` command line argument is optional, even if you have more than one coding standard installed. If no coding standard is specified, PHP_CodeSniffer will default to checking against the _PEAR_ coding standard, or the standard you have set as the default. [View instructions for setting the default coding standard](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-default-coding-standard).
17
+
> The `--standard` command line argument is optional, even if you have more than one coding standard installed. If no coding standard is specified, PHP_CodeSniffer will default to checking against the _PSR12_ coding standard, or the standard you have set as the default. [View instructions for setting the default coding standard](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-default-coding-standard).
18
18
19
19
<palign="right"><ahref="#table-of-contents">back to top</a></p>
20
20
@@ -148,7 +148,7 @@ With verbose output enabled, PHP_CodeSniffer will print the file that it is chec
Changing into directory src/Standards/Generic/Sniffs/Arrays
154
154
Processing ArrayIndentSniff.php [1409 tokens in 193 lines]... DONE in 39ms (4 errors, 20 warnings)
@@ -167,10 +167,10 @@ Processing OpeningBraceSameLineSniff.php [936 tokens in 123 lines]... DONE in 26
167
167
168
168
PHP_CodeSniffer can have multiple coding standards installed to allow a single installation to be used with multiple projects. When checking PHP code, PHP_CodeSniffer can be told which coding standard to use. This is done using the `--standard` command line argument.
169
169
170
-
The example below checks the `myfile.inc` file for violations against the _PEAR_ coding standard (installed by default).
170
+
The example below checks the `myfile.inc` file for violations against the _PSR12_ coding standard (installed by default).
171
171
172
172
```bash
173
-
$ phpcs --standard=PEAR /path/to/code/myfile.inc
173
+
$ phpcs --standard=PSR12 /path/to/code/myfile.inc
174
174
```
175
175
176
176
You can also tell PHP_CodeSniffer to use an external standard by specifying the full path to the standard's root directory on the command line. An external standard is one that is stored outside of PHP_CodeSniffer's `Standards` directory.
Multiple coding standards can be checked at the same time by passing a list of comma separated standards on the command line. A mix of external and installed coding standards can be passed if required.
0 commit comments