Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Do not attempt to sort item when it disables packagist #1039

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 [`4.4.0...main`][4.4.0...main].

### Fixed

- Stopped sorting an item in `repositories` when it disables packagist ([#1039]), by [@localheinz]

## [`4.4.0`][4.4.0]

For a full diff see [`4.3.0...4.4.0`][4.3.0...4.4.0].
Expand Down Expand Up @@ -664,6 +668,7 @@ For a full diff see [`5d8b3e2...0.1.0`][5d8b3e2...0.1.0].
[#992]: https://github.com/ergebnis/json-normalizer/pull/992
[#1001]: https://github.com/ergebnis/json-normalizer/pull/1001
[#1027]: https://github.com/ergebnis/json-normalizer/pull/1027
[#1039]: https://github.com/ergebnis/json-normalizer/pull/1039

[@alexis-saransig-lullabot]: https://github.com/alexis-saransig-lullabot
[@BackEndTea]: https://github.com/BackEndTea
Expand Down
5 changes: 0 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
<code>$value</code>
</MixedAssignment>
</file>
<file src="src/Vendor/Composer/RepositoriesHashNormalizer.php">
<MixedAssignment>
<code>$repository</code>
</MixedAssignment>
</file>
<file src="src/Vendor/Composer/VersionConstraintNormalizer.php">
<MixedAssignment>
<code>$value</code>
Expand Down
7 changes: 7 additions & 0 deletions src/Vendor/Composer/RepositoriesHashNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public function normalize(Json $json): Json
}

foreach ($repositories as &$repository) {
/**
* @see https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org
*/
if (!\is_array($repository) && !\is_object($repository)) {
continue;
}

$repository = (array) $repository;

foreach (self::PROPERTIES_WITH_WILDCARDS as $property) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "ergebnis/json-normalizer",
"description": "Provides generic and vendor-specific normalizers for normalizing JSON documents.",
"license": "MIT",
"type": "library",
"keywords": [
"json",
"normalizer"
],
"authors": [
{
"name": "Andreas Möller",
"email": "[email protected]"
}
],
"homepage": "https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org",
"repositories": [
{
"packagist": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "ergebnis/json-normalizer",
"description": "Provides generic and vendor-specific normalizers for normalizing JSON documents.",
"license": "MIT",
"type": "library",
"keywords": [
"json",
"normalizer"
],
"authors": [
{
"name": "Andreas Möller",
"email": "[email protected]"
}
],
"homepage": "https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org",
"repositories": [
{
"packagist": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "ergebnis/json-normalizer",
"description": "Provides generic and vendor-specific normalizers for normalizing JSON documents.",
"license": "MIT",
"type": "library",
"keywords": [
"json",
"normalizer"
],
"authors": [
{
"name": "Andreas Möller",
"email": "[email protected]"
}
],
"homepage": "https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org",
"repositories": {
"packagist": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "ergebnis/json-normalizer",
"description": "Provides generic and vendor-specific normalizers for normalizing JSON documents.",
"license": "MIT",
"type": "library",
"keywords": [
"json",
"normalizer"
],
"authors": [
{
"name": "Andreas Möller",
"email": "[email protected]"
}
],
"homepage": "https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org",
"repositories": {
"packagist": false
}
}
Loading