Skip to content

Commit

Permalink
Make sure the pool builder excludes php-ext/php-ext-zend
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Mar 20, 2024
1 parent 4997b9e commit dfa0ceb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Composer/DependencyResolver/PoolBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class PoolBuilder
private $updateAllowList = [];
/** @var array<string, array<PackageInterface>> */
private $skippedLoad = [];
/** @var list<string> */
private $ignoredTypes = [];

/**
* If provided, only these package names are loaded
Expand Down Expand Up @@ -170,6 +172,14 @@ public function __construct(array $acceptableStabilities, array $stabilityFlags,
$this->temporaryConstraints = $temporaryConstraints;
}

/**
* @param list<string> $types
*/
public function setIgnoredTypes(array $types): void
{
$this->ignoredTypes = $types;
}

/**
* @param RepositoryInterface[] $repositories
*/
Expand Down Expand Up @@ -416,6 +426,10 @@ private function loadPackagesMarkedForLoading(Request $request, array $repositor
*/
private function loadPackage(Request $request, array $repositories, BasePackage $package, bool $propagateUpdate): void
{
if (in_array($package->getType(), $this->ignoredTypes, true)) {
return;
}

$index = $this->indexCounter++;
$this->packages[$index] = $package;

Expand Down
1 change: 1 addition & 0 deletions src/Composer/Repository/RepositorySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public function isPackageAcceptable(array $names, string $stability): bool
public function createPool(Request $request, IOInterface $io, ?EventDispatcher $eventDispatcher = null, ?PoolOptimizer $poolOptimizer = null): Pool
{
$poolBuilder = new PoolBuilder($this->acceptableStabilities, $this->stabilityFlags, $this->rootAliases, $this->rootReferences, $io, $eventDispatcher, $poolOptimizer, $this->temporaryConstraints);
$poolBuilder->setIgnoredTypes(['php-ext', 'php-ext-zend']);

foreach ($this->repositories as $repo) {
if (($repo instanceof InstalledRepositoryInterface || $repo instanceof InstalledRepository) && !$this->allowInstalledRepositories) {
Expand Down

0 comments on commit dfa0ceb

Please sign in to comment.