Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests and linting

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"php": "^7.4 || ^8.0",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"doctrine/inflector": "^1.0 || ^2.0",
"ext-json": "*"
"ext-json": "*",
"composer/metadata-minifier": "^1.0"
},
"require-dev": {
"phpspec/phpspec": "^6.0 || ^7.0",
Expand Down
15 changes: 2 additions & 13 deletions src/Packagist/Api/Result/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Packagist\Api\Result;

use Composer\MetadataMinifier\MetadataMinifier;
use InvalidArgumentException;
use Packagist\Api\Result\Package\Author;
use Packagist\Api\Result\Package\Dist;
Expand Down Expand Up @@ -131,19 +132,6 @@ public function createPackageResults(array $package): Package
$version['name'] ??= '';
$version['type'] ??= '';

if (isset($version['conflict']) && !is_array($version['conflict'])) {
unset($version['conflict']);
}
if (isset($version['suggest']) && !is_array($version['suggest'])) {
unset($version['suggest']);
}
if (isset($version['replace']) && !is_array($version['replace'])) {
unset($version['replace']);
}
if (isset($version['provide']) && !is_array($version['provide'])) {
unset($version['provide']);
}

if (isset($version['authors']) && $version['authors']) {
foreach ($version['authors'] as $key => $author) {
// Cast some potentially null properties to empty strings
Expand Down Expand Up @@ -198,6 +186,7 @@ public function createComposer2PackagesResults(array $packages): array
$created = [];

foreach ($packages as $name => $package) {
$package = MetadataMinifier::expand($package);
// Create an empty package, only contains versions
$createdPackage = array(
'versions' => [],
Expand Down