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

Breadcrumb

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

function CompilingMatcher::match

Evaluates the expression: $constraint match $operator $version

@phpstan-param Constraint::OP_* $operator

Parameters

ConstraintInterface $constraint:

int $operator:

string $version:

Return value

bool

7 calls to CompilingMatcher::match()
ComposerRepository::isVersionAcceptable in vendor/composer/composer/src/Composer/Repository/ComposerRepository.php
@phpstan-param array<key-of<BasePackage::STABILITIES>, BasePackage::STABILITY_*>|null $acceptableStabilities
DefaultPolicy::versionCompare in vendor/composer/composer/src/Composer/DependencyResolver/DefaultPolicy.php
@phpstan-param Constraint::STR_OP_* $operator
Pool::match in vendor/composer/composer/src/Composer/DependencyResolver/Pool.php
Checks if the package matches the given constraint directly or through provided or replaced packages
PoolBuilder::buildPool in vendor/composer/composer/src/Composer/DependencyResolver/PoolBuilder.php
PoolOptimizer::optimizeByIdenticalDependencies in vendor/composer/composer/src/Composer/DependencyResolver/PoolOptimizer.php

... See full list

File

vendor/composer/semver/src/CompilingMatcher.php, line 69

Class

CompilingMatcher
Helper class to evaluate constraint by compiling and reusing the code to evaluate

Namespace

Composer\Semver

Code

public static function match(ConstraintInterface $constraint, $operator, $version) {
    $resultCacheKey = $operator . $constraint . ';' . $version;
    if (isset(self::$resultCache[$resultCacheKey])) {
        return self::$resultCache[$resultCacheKey];
    }
    if (self::$enabled === null) {
        self::$enabled = !\in_array('eval', explode(',', (string) ini_get('disable_functions')), true);
    }
    if (!self::$enabled) {
        return self::$resultCache[$resultCacheKey] = $constraint->matches(new Constraint(self::$transOpInt[$operator], $version));
    }
    $cacheKey = $operator . $constraint;
    if (!isset(self::$compiledCheckerCache[$cacheKey])) {
        $code = $constraint->compile($operator);
        self::$compiledCheckerCache[$cacheKey] = $function = eval('return function($v, $b){return ' . $code . ';};');
    }
    else {
        $function = self::$compiledCheckerCache[$cacheKey];
    }
    return self::$resultCache[$resultCacheKey] = $function($version, strpos($version, 'dev-') === 0);
}

API Navigation

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