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

Breadcrumb

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

function VersionGuesser::guessVersion

@phpstan-return Version|null

Parameters

array<string, mixed> $packageConfig:

string $path Path to guess into:

File

vendor/composer/composer/src/Composer/Package/Version/VersionGuesser.php, line 73

Class

VersionGuesser
Try to guess the current version number based on different VCS configuration.

Namespace

Composer\Package\Version

Code

public function guessVersion(array $packageConfig, string $path) : ?array {
    if (!function_exists('proc_open')) {
        return null;
    }
    // bypass version guessing in bash completions as it takes time to create
    // new processes and the root version is usually not that important
    if (Platform::isInputCompletionProcess()) {
        return null;
    }
    $versionData = $this->guessGitVersion($packageConfig, $path);
    if (null !== $versionData['version']) {
        return $this->postprocess($versionData);
    }
    $versionData = $this->guessHgVersion($packageConfig, $path);
    if (null !== $versionData && null !== $versionData['version']) {
        return $this->postprocess($versionData);
    }
    $versionData = $this->guessFossilVersion($path);
    if (null !== $versionData['version']) {
        return $this->postprocess($versionData);
    }
    $versionData = $this->guessSvnVersion($packageConfig, $path);
    if (null !== $versionData && null !== $versionData['version']) {
        return $this->postprocess($versionData);
    }
    return null;
}

API Navigation

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