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

Breadcrumb

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

function Rule::getRequiredPackage

File

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

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 getRequiredPackage() : ?string {
    switch ($this->getReason()) {
        case self::RULE_ROOT_REQUIRE:
            return $this->getReasonData()['packageName'];
        case self::RULE_FIXED:
            return $this->getReasonData()['package']
                ->getName();
        case self::RULE_PACKAGE_REQUIRES:
            return $this->getReasonData()
                ->getTarget();
    }
    return null;
}

API Navigation

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