Skip to content

Commit

Permalink
Merge pull request #859 from ergebnis/fix/readme
Browse files Browse the repository at this point in the history
Fix: Update `README.md`
  • Loading branch information
localheinz authored Dec 29, 2021
2 parents ff901b8 + 7a419f2 commit eb35037
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The `NormalizeCommand` provided by the `NormalizePlugin` within this package wil

- determine whether a `composer.json` exists
- determine whether a `composer.lock` exists, and if so, whether it is up to date (unless the `--no-check-lock` option is used)
- use [normalizers](https://github.com/ergebnis/composer-normalize#normalizers) to normalize the content of `composer.json`
- use [`Ergebnis\Json\Normalizer\Vendor\Composer\ComposerJsonNormalizer`](https://github.com/ergebnis/json-normalizer#vendorcomposercomposerjsonnormalizer) to normalize the content of `composer.json`
- format the normalized content (either as sniffed, or as specified using the `--indent-size` and `--indent-style` options)
- write the normalized and formatted content of `composer.json` back to the file
- update the hash in `composer.lock` if it exists and if an update is necessary
Expand Down Expand Up @@ -159,72 +159,6 @@ composer normalize --dry-run
In case `composer.json` is not normalized (or `composer.lock` is not up-to-date), the command will
fail with an exit code of `1` and show a diff.

## Normalizers

The `ComposerJsonNormalizer` composes normalizers provided by [`ergebnis/json-normalizer`](https://github.com/ergebnis/json-normalizer):

- [`Ergebnis\Json\Normalizer\ChainNormalizer`](https://github.com/ergebnis/json-normalizer#chainnormalizer)
- [`Ergebnis\Json\Normalizer\SchemaNormalizer`](https://github.com/ergebnis/json-normalizer#schemanormalizer)

as well as the following normalizers provided by this package:

- [`Ergebnis\Composer\Json\Normalizer\BinNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#binnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\ConfigHashNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#confighashnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\PackageHashNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#packagehashnormalizer)
- [`Ergebnis\Composer\Json\Normalizer\VersionConstraintNormalizer`](https://github.com/ergebnis/composer-normalize/blob/main/README.md#versionconstraintnormalizer)

### `BinNormalizer`

If `composer.json` contains an array of scripts in the `bin` section, the `BinNormalizer` will sort the elements of the `bin` section by value in ascending order.

:bulb: Find out more about the `bin` section at https://getcomposer.org/doc/04-schema.md#bin.

### `ConfigHashNormalizer`

If `composer.json` contains any configuration in the

- `config`
- `extra`
- `scripts-descriptions`

sections, the `ConfigHashNormalizer` will sort the content of these sections by key in ascending order.

:bulb: Find out more about the `config` section at https://getcomposer.org/doc/06-config.md.

### `PackageHashNormalizer`

If `composer.json` contains any configuration in the

- `conflict`
- `provide`
- `replace`
- `require`
- `require-dev`
- `suggest`

sections, the `PackageHashNormalizer` will sort the content of these sections.

:bulb: This transfers the behaviour from using the `--sort-packages` or `sort-packages` configuration flag to other sections. Find out more about the `--sort-packages` flag and configuration at https://getcomposer.org/doc/06-config.md#sort-packages and https://getcomposer.org/doc/03-cli.md#require.

### `VersionConstraintNormalizer`

If `composer.json` contains version constraints in the

- `conflict`
- `provide`
- `replace`
- `require`
- `require-dev`

sections, the `VersionConstraintNormalizer` will ensure that

- all constraints are trimmed
- *and- constraints are separated by a single space (` `) or a comma (`,`)
- *or- constraints are separated by double-pipe with a single space before and after (` || `)
- *range- constraints are separated by a single space (` `)

:bulb: Find out more about version constraints at https://getcomposer.org/doc/articles/versions.md.

## Examples

### `pestphp/pest`
Expand Down

0 comments on commit eb35037

Please sign in to comment.