Skip to content

Commit 771d652

Browse files
authored
Merge pull request #1 from DealerDirect/phpcs-config-set-version
PHPCS Configuration management
2 parents ca4557e + 9b40c25 commit 771d652

File tree

4 files changed

+213
-177
lines changed

4 files changed

+213
-177
lines changed

README.md

+3-37
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,9 @@ Add the following lines to your `composer.json` file:
2727
"require-dev": {
2828
"squizlabs/php_codesniffer": "^2.0.0",
2929
"dealerdirect/phpcodesniffer-composer-installer" : "*",
30-
"wimg/php-compatibility": "*"
31-
},
32-
"extra": {
33-
"phpcodesniffer-mapping": {
34-
"wimg/php-compatibility": "PHPCompatibility"
35-
}
30+
"frenck/php-compatibility": "*"
3631
}
3732
```
38-
## Mapping Coding Standards
39-
40-
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.
6233

6334
## Developing Coding Standards
6435

@@ -74,20 +45,15 @@ Create a composer package of your coding standard by adding a `composer.json` fi
7445
"php" : ">=5.4.0,<8.0.0-dev",
7546
"squizlabs/php_codesniffer" : "^2.0"
7647
},
77-
"type" : "phpcodesniffer-standard",
78-
"extra": {
79-
"phpcodesniffer-standard": "ACME"
80-
}
48+
"type" : "phpcodesniffer-standard"
8149
}
8250
```
8351

8452
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.
8654
* 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].
8855

8956
[this]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial
90-
[metapackage]: https://getcomposer.org/doc/04-schema.md#type
9157

9258
## Contributing
9359

composer.json

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"composer-plugin-api": "^1.0",
2828
"squizlabs/php_codesniffer": "*"
2929
},
30+
"require-dev": {
31+
"composer/composer": "*"
32+
},
3033
"suggest": {
3134
"dealerdirect/qa-tools": "All the PHP QA tools you'll need"
3235
},

src/Installer.php

-137
This file was deleted.

0 commit comments

Comments
 (0)