function InstalledPackagesList::getPackagesWithDifferentVersionsIn

Returns the packages which have a different version in another list.

This compares this list with another one, and returns a list of packages which are present in both, but in different versions.

Parameters

self $other: Another list of installed packages.

Return value

static A list of packages which are present in both this list and the other one, but in different versions, keyed by name.

File

core/modules/package_manager/src/InstalledPackagesList.php, line 88

Class

InstalledPackagesList
Defines a class to list installed Composer packages.

Namespace

Drupal\package_manager

Code

public function getPackagesWithDifferentVersionsIn(self $other) : static {
    // Only compare packages that are both here and there.
    $packages = array_intersect_key($this->getArrayCopy(), $other->getArrayCopy());
    $packages = array_filter($packages, fn(InstalledPackage $p) => Comparator::notEqualTo($p->version, $other[$p->name]->version));
    return new static($packages);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.