Template for use with pull request on custom code standard projects
To gain more widespread support for PHPCodeSniffer installers (not just this project) it is important that maintainers of custom code-standard adapt using the "type" : "phpcodesniffer-standard"
in their project's composer.json
.
Opening an issue (or even better: a pull-request) for such a change is trivial. Finding the right words to explain the rationale can be more daunting.
Below is a template that can be use ad-verbatim to accompany any issue or pull-request to add "type" : "phpcodesniffer-standard"
to a projects composer file.
The text below can be selected and copied as-is:
## Problem/Motivation
Composer allows declaring [the type of a package][composer-package-type]. When no
type is declared, the default is "library".
There are various [composer plugins][composer-plugin] that can install custom
PHP CodeSniffer standards:
- https://github.com/higidi/composer-phpcodesniffer-standards-plugin
- https://github.com/DealerDirect/phpcodesniffer-composer-installer
- https://github.com/SimplyAdmire/ComposerPlugins
For these installers to work, the package type needs to be set to "phpcodesniffer-standard".
There are also [a lot of packages][phpcodesniffer-packages] that adhere to this type.
## Proposed changes
Adding the following line to the `composer.json` will make it possible for such packages to install this custom code-standard using composer:
```json
"type" : "phpcodesniffer-standard"
```
This will in _no way_ change the existing behaviour of this package for users that do not include one of the packages mentioned above in their projects `composer.json`.
[composer-package-type]: https://getcomposer.org/doc/04-schema.md#type
[composer-plugin]: https://getcomposer.org/doc/articles/plugins.md
[phpcodesniffer-packages]: https://github.com/search?p=2&q=filename%3Acomposer.json+type+phpcodesniffer+standard&type=Code&utf8=%E2%9C%93
The template above will render (more or less) like this:
Composer allows declaring the type of a package. If no type is declared, the defaults is "library".
There are various composer plugins that can install custom PHP CodeSniffer standards:
- https://github.com/higidi/composer-phpcodesniffer-standards-plugin
- https://github.com/DealerDirect/phpcodesniffer-composer-installer
- https://github.com/SimplyAdmire/ComposerPlugins
For these installers to work, the package type needs to be set to "phpcodesniffer-standard".
There are also a lot of packages that adhere to this type.
Adding the following line to the composer.json
will make it possible for such packages to install this custom code-standard using composer:
"type" : "phpcodesniffer-standard"
This will in no way change the existing behaviour of this package for users that do not include one of the packages mentioned above in their projects composer.json
.
To the extent possible under law,
Dealerdirect
has waived all copyright and related or neighboring rights to this
"Template for use with pull-request on custom PHPCodesniffer code-standard projects".