1
0
Fork 0

Update semver, fix poolbuilder usage and optimize creation of filtering nameConstraints

pull/8816/head
Jordi Boggiano 2020-04-21 14:50:11 +02:00
parent c9846d4d3c
commit af18c2bd7d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 151 additions and 19 deletions

151
composer.lock generated
View File

@ -60,6 +60,21 @@
"ssl", "ssl",
"tls" "tls"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/1.2.7"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-04-08T08:27:21+00:00" "time": "2020-04-08T08:27:21+00:00"
}, },
{ {
@ -68,19 +83,20 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/semver.git", "url": "https://github.com/composer/semver.git",
"reference": "2fbee6b82f09aeaa3905444eb6652c554411fe55" "reference": "03c921a6ef6ac36ca3aa0113a726e1b473f0f528"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/2fbee6b82f09aeaa3905444eb6652c554411fe55", "url": "https://api.github.com/repos/composer/semver/zipball/03c921a6ef6ac36ca3aa0113a726e1b473f0f528",
"reference": "2fbee6b82f09aeaa3905444eb6652c554411fe55", "reference": "03c921a6ef6ac36ca3aa0113a726e1b473f0f528",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3.2 || ^7.0" "php": "^5.3.2 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.5 || ^5.0.5" "phpstan/phpstan": "^0.12.19",
"phpunit/phpunit": "^4.5 || ^5.0.5 || ^7"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -121,7 +137,12 @@
"validation", "validation",
"versioning" "versioning"
], ],
"time": "2020-04-16T13:02:51+00:00" "support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/master"
},
"time": "2020-04-21T12:22:29+00:00"
}, },
{ {
"name": "composer/spdx-licenses", "name": "composer/spdx-licenses",
@ -181,6 +202,11 @@
"spdx", "spdx",
"validator" "validator"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/spdx-licenses/issues",
"source": "https://github.com/composer/spdx-licenses/tree/1.5.3"
},
"time": "2020-02-14T07:44:31+00:00" "time": "2020-02-14T07:44:31+00:00"
}, },
{ {
@ -225,6 +251,17 @@
"Xdebug", "Xdebug",
"performance" "performance"
], ],
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/xdebug-handler/issues",
"source": "https://github.com/composer/xdebug-handler/tree/master"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
}
],
"time": "2020-03-01T12:26:26+00:00" "time": "2020-03-01T12:26:26+00:00"
}, },
{ {
@ -291,6 +328,10 @@
"json", "json",
"schema" "schema"
], ],
"support": {
"issues": "https://github.com/justinrainbow/json-schema/issues",
"source": "https://github.com/justinrainbow/json-schema/tree/5.2.9"
},
"time": "2019-09-25T14:49:45+00:00" "time": "2019-09-25T14:49:45+00:00"
}, },
{ {
@ -338,6 +379,9 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.3"
},
"time": "2020-03-23T09:12:05+00:00" "time": "2020-03-23T09:12:05+00:00"
}, },
{ {
@ -375,12 +419,6 @@
"license": [ "license": [
"MIT" "MIT"
], ],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP", "description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2016-03-07T13:46:50+00:00" "time": "2016-03-07T13:46:50+00:00"
}, },
@ -431,6 +469,10 @@
"parser", "parser",
"validator" "validator"
], ],
"support": {
"issues": "https://github.com/Seldaek/jsonlint/issues",
"source": "https://github.com/Seldaek/jsonlint/tree/1.7.2"
},
"time": "2019-10-24T14:27:39+00:00" "time": "2019-10-24T14:27:39+00:00"
}, },
{ {
@ -475,6 +517,10 @@
"keywords": [ "keywords": [
"phar" "phar"
], ],
"support": {
"issues": "https://github.com/Seldaek/phar-utils/issues",
"source": "https://github.com/Seldaek/phar-utils/tree/1.1.0"
},
"time": "2020-02-14T15:25:33+00:00" "time": "2020-02-14T15:25:33+00:00"
}, },
{ {
@ -536,6 +582,9 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/console/tree/v2.8.52"
},
"time": "2018-11-20T15:55:20+00:00" "time": "2018-11-20T15:55:20+00:00"
}, },
{ {
@ -593,6 +642,9 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/debug/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00" "time": "2018-11-11T11:18:13+00:00"
}, },
{ {
@ -643,6 +695,9 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v2.8.52"
},
"time": "2018-11-11T11:18:13+00:00" "time": "2018-11-11T11:18:13+00:00"
}, },
{ {
@ -692,6 +747,9 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00" "time": "2018-11-11T11:18:13+00:00"
}, },
{ {
@ -750,6 +808,23 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.15.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-02-27T09:26:54+00:00" "time": "2020-02-27T09:26:54+00:00"
}, },
{ {
@ -809,6 +884,23 @@
"portable", "portable",
"shim" "shim"
], ],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.15.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-03-09T19:04:49+00:00" "time": "2020-03-09T19:04:49+00:00"
}, },
{ {
@ -858,6 +950,9 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v2.8.50"
},
"time": "2018-11-11T11:18:13+00:00" "time": "2018-11-11T11:18:13+00:00"
} }
], ],
@ -914,6 +1009,10 @@
"constructor", "constructor",
"instantiate" "instantiate"
], ],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/master"
},
"time": "2015-06-14T21:17:01+00:00" "time": "2015-06-14T21:17:01+00:00"
}, },
{ {
@ -963,6 +1062,10 @@
"email": "mike.vanriel@naenius.com" "email": "mike.vanriel@naenius.com"
} }
], ],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x"
},
"time": "2016-01-25T08:17:30+00:00" "time": "2016-01-25T08:17:30+00:00"
}, },
{ {
@ -1026,6 +1129,10 @@
"spy", "spy",
"stub" "stub"
], ],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00" "time": "2020-03-05T15:02:03+00:00"
}, },
{ {
@ -1090,6 +1197,10 @@
"compare", "compare",
"equality" "equality"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/1.2"
},
"time": "2017-01-29T09:50:25+00:00" "time": "2017-01-29T09:50:25+00:00"
}, },
{ {
@ -1142,6 +1253,10 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/1.4"
},
"time": "2017-05-22T07:24:03+00:00" "time": "2017-05-22T07:24:03+00:00"
}, },
{ {
@ -1209,6 +1324,10 @@
"export", "export",
"exporter" "exporter"
], ],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/master"
},
"time": "2016-11-19T08:54:04+00:00" "time": "2016-11-19T08:54:04+00:00"
}, },
{ {
@ -1262,6 +1381,10 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
},
"time": "2016-11-19T07:33:16+00:00" "time": "2016-11-19T07:33:16+00:00"
}, },
{ {
@ -1327,6 +1450,9 @@
], ],
"description": "Symfony PHPUnit Bridge", "description": "Symfony PHPUnit Bridge",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v3.4.38"
},
"time": "2020-02-21T08:01:47+00:00" "time": "2020-02-21T08:01:47+00:00"
} }
], ],
@ -1343,5 +1469,6 @@
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "5.3.9" "php": "5.3.9"
} },
"plugin-api-version": "2.0.0"
} }

View File

@ -122,7 +122,7 @@ class PoolBuilder
} }
$loadNames[$packageName] = $constraint; $loadNames[$packageName] = $constraint;
$this->nameConstraints[$packageName] = $constraint ? new MultiConstraint(array($constraint), false) : null; $this->nameConstraints[$packageName] = $constraint && !($constraint instanceof EmptyConstraint) ? array($constraint) : null;
} }
// clean up loadNames for anything we manually marked loaded above // clean up loadNames for anything we manually marked loaded above
@ -159,11 +159,17 @@ class PoolBuilder
} }
// filter packages according to all the require statements collected for each package // filter packages according to all the require statements collected for each package
$nameConstraints = array();
foreach ($this->nameConstraints as $name => $constraints) {
if (is_array($constraints)) {
$nameConstraints[$name] = MultiConstraint::create(array_values(array_unique($constraints)), false);
}
}
foreach ($this->packages as $i => $package) { foreach ($this->packages as $i => $package) {
// we check all alias related packages at once, so no need to check individual aliases // we check all alias related packages at once, so no need to check individual aliases
// isset also checks non-null value // isset also checks non-null value
if (!$package instanceof AliasPackage && isset($this->nameConstraints[$package->getName()])) { if (!$package instanceof AliasPackage && isset($nameConstraints[$package->getName()])) {
$constraint = $this->nameConstraints[$package->getName()]; $constraint = $nameConstraints[$package->getName()];
$aliasedPackages = array($i => $package); $aliasedPackages = array($i => $package);
if (isset($this->aliasMap[spl_object_hash($package)])) { if (isset($this->aliasMap[spl_object_hash($package)])) {
@ -270,10 +276,9 @@ class PoolBuilder
$linkConstraint = $link->getConstraint(); $linkConstraint = $link->getConstraint();
if ($linkConstraint && !($linkConstraint instanceof EmptyConstraint)) { if ($linkConstraint && !($linkConstraint instanceof EmptyConstraint)) {
if (!array_key_exists($require, $this->nameConstraints)) { if (!array_key_exists($require, $this->nameConstraints)) {
$this->nameConstraints[$require] = new MultiConstraint(array($linkConstraint), false); $this->nameConstraints[$require] = array($linkConstraint);
} elseif ($this->nameConstraints[$require]) { } elseif (is_array($this->nameConstraints[$require])) {
// TODO addConstraint function? $this->nameConstraints[$require][] = $linkConstraint;
$this->nameConstraints[$require] = new MultiConstraint(array_merge(array($linkConstraint), $this->nameConstraints[$require]->getConstraints()), false);
} }
// else it is null and should stay null // else it is null and should stay null
} else { } else {