Skip to content

Commit

Permalink
Merge pull request #463 from ergebnis/fix/composer-plugin-api
Browse files Browse the repository at this point in the history
Fix: Correctly sort composer-plugin-api
  • Loading branch information
ergebnis-bot authored Mar 6, 2021
2 parents e1d2c72 + 0e5baab commit a71c1a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`1.0.2...main`][1.0.2...main].

### Fixed

* Adjusted `Vendor\Composer\PackageHashNormalizer` to take into account the newly addded `composer-plugin-api` as platform requirement ([#463]), by [@localheinz]

## [`1.0.2`][1.0.2]

For a full diff see [`1.0.1...1.0.2`][1.0.1...1.0.2].
Expand Down Expand Up @@ -400,6 +404,7 @@ For a full diff see [`5d8b3e2...0.1.0`][5d8b3e2...0.1.0].
[#424]: https://github.com/ergebnis/json-normalizer/pull/424
[#425]: https://github.com/ergebnis/json-normalizer/pull/425
[#429]: https://github.com/ergebnis/json-normalizer/pull/429
[#463]: https://github.com/ergebnis/json-normalizer/pull/463

[@BackEndTea]: https://github.com/BackEndTea
[@ergebnis]: https://github.com/ergebnis
Expand Down
4 changes: 2 additions & 2 deletions src/Vendor/Composer/PackageHashNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
final class PackageHashNormalizer implements NormalizerInterface
{
/**
* @see https://github.com/composer/composer/blob/1.6.2/src/Composer/Repository/PlatformRepository.php#L27
* @see https://github.com/composer/composer/blob/2.0.11/src/Composer/Repository/PlatformRepository.php#L33
*/
private const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
private const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD';

private const PROPERTIES_THAT_SHOULD_BE_NORMALIZED = [
'conflict',
Expand Down
4 changes: 4 additions & 0 deletions test/Unit/Vendor/Composer/PackageHashNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public function testNormalizeSortsPackageHashIfPropertyExists(string $property):
"hhvm": "Okay",
"lib-baz": "Maybe it helps.",
"localheinz/php-cs-fixer-config": "Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.",
"acquia/drupal-environment-detector": "^1.2.0",
"ext-foo": "Could be useful",
"composer-plugin-api": "^2.0.0",
"php": "Because why not, it's great."
},
"foo": {
Expand All @@ -97,6 +99,8 @@ public function testNormalizeSortsPackageHashIfPropertyExists(string $property):
"hhvm": "Okay",
"ext-foo": "Could be useful",
"lib-baz": "Maybe it helps.",
"composer-plugin-api": "^2.0.0",
"acquia/drupal-environment-detector": "^1.2.0",
"localheinz/php-cs-fixer-config": "Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.",
"localheinz/test-util": "Provides utilities for tests."
},
Expand Down

0 comments on commit a71c1a4

Please sign in to comment.