Skip to content

Commit

Permalink
Merge pull request #1 from DealerDirect/phpcs-config-set-version
Browse files Browse the repository at this point in the history
PHPCS Configuration management
  • Loading branch information
frenck authored Nov 1, 2016
2 parents ca4557e + 9b40c25 commit 771d652
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 177 deletions.
40 changes: 3 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,9 @@ Add the following lines to your `composer.json` file:
"require-dev": {
"squizlabs/php_codesniffer": "^2.0.0",
"dealerdirect/phpcodesniffer-composer-installer" : "*",
"wimg/php-compatibility": "*"
},
"extra": {
"phpcodesniffer-mapping": {
"wimg/php-compatibility": "PHPCompatibility"
}
"frenck/php-compatibility": "*"
}
```
## Mapping Coding Standards

In case a coding standard does not provide its PHP_CodeSniffer standard name, this plugin
will create a name for it. Like in the example above, the `wimg/php-compatibility` package
provides a coding standard called 'PHPCompatibility', nevertheless, the package does not
provide this name.

The `phpcodesniffer-mapping` parameter in the `extra` section of your `composer.json` allows
you to provide a name yourself.

The following example will install the same repository as above, but will name the standard
`PHPCompat` instead of `PHPCompatibility` as show in the first version.

```json
"extra": {
"phpcodesniffer-mapping": {
"wimg/php-compatibility": "PHPCompat"
}
}
```

The above mapping can also be used to override the coding standard name, if the package
provided one. This may be useful to avoid collisions between different coding standards
using the same name.

## Developing Coding Standards

Expand All @@ -74,20 +45,15 @@ Create a composer package of your coding standard by adding a `composer.json` fi
"php" : ">=5.4.0,<8.0.0-dev",
"squizlabs/php_codesniffer" : "^2.0"
},
"type" : "phpcodesniffer-standard",
"extra": {
"phpcodesniffer-standard": "ACME"
}
"type" : "phpcodesniffer-standard"
}
```

Requirements:
* 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].
* The repository may contain one or more standards. Each in their separate directory in the root of your repository.
* The package `type` must be `phpcodesniffer-standard`. Without this, the plugin will not trigger.
* 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].

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

## Contributing

Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"composer-plugin-api": "^1.0",
"squizlabs/php_codesniffer": "*"
},
"require-dev": {
"composer/composer": "*"
},
"suggest": {
"dealerdirect/qa-tools": "All the PHP QA tools you'll need"
},
Expand Down
137 changes: 0 additions & 137 deletions src/Installer.php

This file was deleted.

Loading

0 comments on commit 771d652

Please sign in to comment.