1
0
Fork 0

Merge branch '2.0'

pull/9828/head
Jordi Boggiano 2021-04-07 15:58:25 +02:00
commit a4eb2d4096
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 87 additions and 72 deletions

View File

@ -24,6 +24,7 @@
"require": { "require": {
"php": "^5.3.2 || ^7.0 || ^8.0", "php": "^5.3.2 || ^7.0 || ^8.0",
"composer/ca-bundle": "^1.0", "composer/ca-bundle": "^1.0",
"composer/metadata-minifier": "^1.0",
"composer/semver": "^3.0", "composer/semver": "^3.0",
"composer/spdx-licenses": "^1.2", "composer/spdx-licenses": "^1.2",
"composer/xdebug-handler": "^1.1", "composer/xdebug-handler": "^1.1",

86
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "25f0d90eaaae2900e23844f74e662e82", "content-hash": "5275194a1c51ef2f95f92838cc728abc",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -82,6 +82,75 @@
], ],
"time": "2021-01-12T12:10:35+00:00" "time": "2021-01-12T12:10:35+00:00"
}, },
{
"name": "composer/metadata-minifier",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/composer/metadata-minifier.git",
"reference": "c549d23829536f0d0e984aaabbf02af91f443207"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207",
"reference": "c549d23829536f0d0e984aaabbf02af91f443207",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0 || ^8.0"
},
"require-dev": {
"composer/composer": "^2",
"phpstan/phpstan": "^0.12.55",
"symfony/phpunit-bridge": "^4.2 || ^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\MetadataMinifier\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Small utility library that handles metadata minification and expansion.",
"keywords": [
"composer",
"compression"
],
"support": {
"issues": "https://github.com/composer/metadata-minifier/issues",
"source": "https://github.com/composer/metadata-minifier/tree/1.0.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2021-04-07T13:37:33+00:00"
},
{ {
"name": "composer/semver", "name": "composer/semver",
"version": "3.2.4", "version": "3.2.4",
@ -244,16 +313,16 @@
}, },
{ {
"name": "composer/xdebug-handler", "name": "composer/xdebug-handler",
"version": "1.4.5", "version": "1.4.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/xdebug-handler.git", "url": "https://github.com/composer/xdebug-handler.git",
"reference": "f28d44c286812c714741478d968104c5e604a1d4" "reference": "f27e06cd9675801df441b3656569b328e04aa37c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f27e06cd9675801df441b3656569b328e04aa37c",
"reference": "f28d44c286812c714741478d968104c5e604a1d4", "reference": "f27e06cd9675801df441b3656569b328e04aa37c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -261,7 +330,8 @@
"psr/log": "^1.0" "psr/log": "^1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" "phpstan/phpstan": "^0.12.55",
"symfony/phpunit-bridge": "^4.2 || ^5"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -287,7 +357,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/composer", "irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues", "issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/1.4.5" "source": "https://github.com/composer/xdebug-handler/tree/1.4.6"
}, },
"funding": [ "funding": [
{ {
@ -303,7 +373,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-11-13T08:04:11+00:00" "time": "2021-03-25T17:01:18+00:00"
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",

View File

@ -35,7 +35,7 @@ use Composer\Semver\Constraint\ConstraintInterface;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Semver\Constraint\MatchAllConstraint; use Composer\Semver\Constraint\MatchAllConstraint;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
use Composer\Util\MetadataMinifier; use Composer\MetadataMinifier\MetadataMinifier;
use Composer\Util\Url; use Composer\Util\Url;
/** /**
@ -510,7 +510,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
return array(); return array();
} }
private function configurePackageTransportOptions(PackageInterface $package) protected function configurePackageTransportOptions(PackageInterface $package)
{ {
foreach ($package->getDistUrls() as $url) { foreach ($package->getDistUrls() as $url) {
if (strpos($url, $this->baseUrl) === 0) { if (strpos($url, $this->baseUrl) === 0) {

View File

@ -12,67 +12,11 @@
namespace Composer\Util; namespace Composer\Util;
class MetadataMinifier @trigger_error('Composer\Util\MetadataMinifier is deprecated, use Composer\MetadataMinifier\MetadataMinifier from composer/metadata-minifier instead.', E_USER_DEPRECATED);
/**
* @deprecated Use Composer\MetadataMinifier\MetadataMinifier instead
*/
class MetadataMinifier extends \Composer\MetadataMinifier\MetadataMinifier
{ {
public static function expand(array $versions)
{
$expanded = array();
$expandedVersion = null;
foreach ($versions as $versionData) {
if (!$expandedVersion) {
$expandedVersion = $versionData;
$expanded[] = $expandedVersion;
continue;
}
// add any changes from the previous version to the expanded one
foreach ($versionData as $key => $val) {
if ($val === '__unset') {
unset($expandedVersion[$key]);
} else {
$expandedVersion[$key] = $val;
}
}
$expanded[] = $expandedVersion;
}
return $expanded;
}
public static function minify(array $versions)
{
$minifiedVersions = array();
$lastKnownVersionData = null;
foreach ($versions as $version) {
if (!$lastKnownVersionData) {
$lastKnownVersionData = $version;
$minifiedVersions[] = $version;
continue;
}
$minifiedVersion = array();
// add any changes from the previous version
foreach ($version as $key => $val) {
if (!isset($lastKnownVersionData[$key]) || $lastKnownVersionData[$key] !== $val) {
$minifiedVersion[$key] = $val;
$lastKnownVersionData[$key] = $val;
}
}
// store any deletions from the previous version for keys missing in current one
foreach ($lastKnownVersionData as $key => $val) {
if (!isset($version[$key])) {
$minifiedVersion[$key] = "__unset";
unset($lastKnownVersionData[$key]);
}
}
$minifiedVersions[] = $minifiedVersion;
}
return $minifiedVersions;
}
} }