diff --git a/CHANGELOG.md b/CHANGELOG.md index 80256016..63af058a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ For a full diff see [`3.0.0...main`][3.0.0...main]. - Adjusted `Vendor\Composer\ComposerJsonNormalizer` to stop sorting `extra.installer-paths` ([#777]), by [@localheinz] - Adjusted `Vendor\Composer\ComposerJsonNormalizer` to stop sorting `config.allow-plugins` ([#778]), by [@localheinz] - Adjusted `Vendor\Composer\ComposerJsonNormalizer` to stop sorting `config.preferred-install` ([#779]), by [@localheinz] +- Adjusted `Vendor\Composer\ComposerJsonNormalizer` to stop sorting children of `extra.patches` ([#780]), by [@localheinz] ### Removed @@ -535,6 +536,7 @@ For a full diff see [`5d8b3e2...0.1.0`][5d8b3e2...0.1.0]. [#777]: https://github.com/ergebnis/json-normalizer/pull/777 [#778]: https://github.com/ergebnis/json-normalizer/pull/778 [#779]: https://github.com/ergebnis/json-normalizer/pull/779 +[#780]: https://github.com/ergebnis/json-normalizer/pull/780 [@BackEndTea]: https://github.com/BackEndTea [@dependabot]: https://github.com/dependabot diff --git a/src/Vendor/Composer/ComposerJsonNormalizer.php b/src/Vendor/Composer/ComposerJsonNormalizer.php index 7767e39d..17743f53 100644 --- a/src/Vendor/Composer/ComposerJsonNormalizer.php +++ b/src/Vendor/Composer/ComposerJsonNormalizer.php @@ -34,6 +34,9 @@ public function __construct(string $schemaUri) Pointer\Specification::equals(Pointer\JsonPointer::fromJsonString('/config/allow-plugins')), Pointer\Specification::equals(Pointer\JsonPointer::fromJsonString('/config/preferred-install')), Pointer\Specification::equals(Pointer\JsonPointer::fromJsonString('/extra/installer-paths')), + Pointer\Specification::closure(static function (Pointer\JsonPointer $jsonPointer): bool { + return 1 === \preg_match('{^\/extra\/patches\/([^/])+$}', $jsonPointer->toJsonString()); + }), Pointer\Specification::equals(Pointer\JsonPointer::fromJsonString('/scripts/auto-scripts')), ), ), diff --git a/test/Fixture/Vendor/Composer/ComposerJsonNormalizer/NormalizeNormalizes/Extra/Patches/normalized.json b/test/Fixture/Vendor/Composer/ComposerJsonNormalizer/NormalizeNormalizes/Extra/Patches/normalized.json index f01abfbd..f1eed7c8 100644 --- a/test/Fixture/Vendor/Composer/ComposerJsonNormalizer/NormalizeNormalizes/Extra/Patches/normalized.json +++ b/test/Fixture/Vendor/Composer/ComposerJsonNormalizer/NormalizeNormalizes/Extra/Patches/normalized.json @@ -21,8 +21,8 @@ "baz": "https://www.drupal.org/files/issues/2019-01-01/baz.patch" }, "drupal/foo": { - "baz": "https://www.drupal.org/files/issues/2019-01-01/baz.patch", - "foo": "https://www.drupal.org/files/issues/2020-12-13/foo.patch" + "foo": "https://www.drupal.org/files/issues/2020-12-13/foo.patch", + "baz": "https://www.drupal.org/files/issues/2019-01-01/baz.patch" } } }