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
In case a coding standard does not provide its PHP_CodeSniffer standard name, this plugin
41
-
will create a name for it. Like in the example above, the `wimg/php-compatibility` package
42
-
provides a coding standard called 'PHPCompatibility', nevertheless, the package does not
43
-
provide this name.
44
-
45
-
The `phpcodesniffer-mapping` parameter in the `extra` section of your `composer.json` allows
46
-
you to provide a name yourself.
47
-
48
-
The following example will install the same repository as above, but will name the standard
49
-
`PHPCompat` instead of `PHPCompatibility` as show in the first version.
50
-
51
-
```json
52
-
"extra": {
53
-
"phpcodesniffer-mapping": {
54
-
"wimg/php-compatibility": "PHPCompat"
55
-
}
56
-
}
57
-
```
58
-
59
-
The above mapping can also be used to override the coding standard name, if the package
60
-
provided one. This may be useful to avoid collisions between different coding standards
61
-
using the same name.
62
33
63
34
## Developing Coding Standards
64
35
@@ -74,20 +45,15 @@ Create a composer package of your coding standard by adding a `composer.json` fi
74
45
"php" : ">=5.4.0,<8.0.0-dev",
75
46
"squizlabs/php_codesniffer" : "^2.0"
76
47
},
77
-
"type" : "phpcodesniffer-standard",
78
-
"extra": {
79
-
"phpcodesniffer-standard": "ACME"
80
-
}
48
+
"type" : "phpcodesniffer-standard"
81
49
}
82
50
```
83
51
84
52
Requirements:
85
-
*Only one (1) standard per repository is allowed. If you'll need to bundle multiple standards, please consider separate packages bundled using a Composer [metapackage].
53
+
*The repository may contain one or more standards. Each in their separate directory in the root of your repository.
86
54
* The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger.
87
-
* Please provide a standard name by specifing the `phpcodesniffer-standard` option in the `extra` section of your `composer.json` With this name, the coding standard will be visible in [PHP_CodeSniffer].
0 commit comments