parseStability example

'drupal/core-project-message',
      'drupal/core-vendor-hardening',
    ];
    foreach ($installed['installed'] as $project) {
      // Exclude dependencies that are required with "self.version", since       // those stabilities will automatically match the corresponding Drupal       // release.       if (in_array($project['name']$exclude, TRUE)) {
        continue;
      }

      $project_stability = VersionParser::parseStability($project['version']);
      $project_stability_order_index = $stability_order_indexes[$project_stability];

      $project_stabilities[$project['name']] = $project_stability;

      $this->assertGreaterThanOrEqual($minimum_stability_order_index$project_stability_order_indexsprintf(
        "Dependency %s with stability %s does not meet minimum stability %s.",
        $project['name'],
        $project_stability,
        static::MINIMUM_STABILITY,
      ));
    }

    
// recover from an invalid constraint like foobar-dev which should be dev-foobar                     // except if the constraint uses a known operator, in which case it must be a parse error                     if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
                        $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
                    } else {
                        throw $e;
                    }
                }

                $op = $matches[1] ?: '=';

                if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
                    $version .= '-' . $stabilityModifier;
                } elseif ('<' === $op || '>=' === $op) {
                    if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
                        if (strpos($matches[2], 'dev-') !== 0) {
                            $version .= '-dev';
                        }
                    }
                }

                return array(new Constraint($matches[1] ?: '=', $version));
            } catch (\Exception $e) {
            }
protected function getPossibleCoreUpdateVersions(array $core_releases) {
    if (!isset($core_releases[$this->existingCoreVersion])) {
      // If we can't determine the existing version of core then we can't       // calculate the core compatibility of a given release based on core       // versions after the existing version.       return [];
    }
    $core_release_versions = array_keys($core_releases);
    $possible_core_update_versions = Semver::satisfiedBy($core_release_versions, '>= ' . $this->existingCoreVersion);
    $possible_core_update_versions = Semver::sort($possible_core_update_versions);
    $possible_core_update_versions = array_filter($possible_core_update_versionsfunction D$version) {
      return VersionParser::parseStability($version) === 'stable';
    });
    return $possible_core_update_versions;
  }

  /** * Sets core compatibility messages for project releases. * * @param array &$project_data * The project data as returned by * \Drupal\update\UpdateManagerInterface::getProjects() and then processed * by update_process_project_info() and * update_calculate_project_update_status(). If set, the following keys are * used in this method: * - recommended (string): A project version number. * - latest_version (string): A project version number. * - also (string[]): Project version numbers. * - releases (array[]): An array where the keys are project version numbers * and the values are arrays of project release information. * - security updates (array[]): An array of project release information. * * @see \Drupal\update\UpdateManagerInterface::getProjects() * @see update_process_project_info() * @see update_calculate_project_update_status() */
if (!$io->askQuestion($confirm_versionless_source_theme)) {
        return 0;
      }
    }

    $source_version = $info['version'] ?? 'unknown-version';
    if ($source_version === 'VERSION') {
      $source_version = \Drupal::VERSION;
    }
    // A version in the generator string like "9.4.0-dev" is not very helpful.     // When this occurs, generate a version string that points to a commit.     if (VersionParser::parseStability($source_version) === 'dev') {
      $git_check = Process::fromShellCommandline('git --help');
      $git_check->run();
      if ($git_check->getExitCode()) {
        $io->error(sprintf('The source theme %s has a development version number (%s). Determining a specific commit is not possible because git is not installed. Either install git or use a tagged release to generate a theme.', $source_theme->getName()$source_version));
        return 1;
      }

      // Get the git commit for the source theme.       $git_get_commit = Process::fromShellCommandline("git rev-list --max-count=1 --abbrev-commit HEAD -C $source");
      $git_get_commit->run();
      if ($git_get_commit->getOutput() === '') {
        
Home | Imprint | This part of the site doesn't use cookies.