Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Rule.php

function Rule::isCausedByLock

File

vendor/composer/composer/src/Composer/DependencyResolver/Rule.php, line 150

Class

Rule
@author Nils Adermann <naderman@naderman.de> @author Ruben Gonzalez <rubenrua@gmail.com> @phpstan-type ReasonData Link|BasePackage|string|int|array{packageName: string, constraint: ConstraintInterface}|array{package: BasePackage}

Namespace

Composer\DependencyResolver

Code

public function isCausedByLock(RepositorySet $repositorySet, Request $request, Pool $pool) : bool {
    if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
        if (PlatformRepository::isPlatformPackage($this->getReasonData()
            ->getTarget())) {
            return false;
        }
        if ($request->getLockedRepository() !== null) {
            foreach ($request->getLockedRepository()
                ->getPackages() as $package) {
                if ($package->getName() === $this->getReasonData()
                    ->getTarget()) {
                    if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
                        return true;
                    }
                    if (!$this->getReasonData()
                        ->getConstraint()
                        ->matches(new Constraint('=', $package->getVersion()))) {
                        return true;
                    }
                    // required package was locked but has been unlocked and still matches
                    if (!$request->isLockedPackage($package)) {
                        return true;
                    }
                    break;
                }
            }
        }
    }
    if ($this->getReason() === self::RULE_ROOT_REQUIRE) {
        if (PlatformRepository::isPlatformPackage($this->getReasonData()['packageName'])) {
            return false;
        }
        if ($request->getLockedRepository() !== null) {
            foreach ($request->getLockedRepository()
                ->getPackages() as $package) {
                if ($package->getName() === $this->getReasonData()['packageName']) {
                    if ($pool->isUnacceptableFixedOrLockedPackage($package)) {
                        return true;
                    }
                    if (!$this->getReasonData()['constraint']
                        ->matches(new Constraint('=', $package->getVersion()))) {
                        return true;
                    }
                    break;
                }
            }
        }
    }
    return false;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal