public function testInvalidBranch() { $this->assertFalse(Validator::validateBranch('1.x')); }
/** * Convert the dependency version. * * @param AssetTypeInterface $assetType The asset type * @param string $dependency The dependency * @param string $version The version * * @return string[] The new dependency and the new version */ public static function convertDependencyVersion(AssetTypeInterface $assetType, $dependency, $version) { $version = str_replace('#', '', $version); $version = empty($version) ? '*' : $version; $version = trim($version); $searchVersion = str_replace(array(' ', '<', '>', '=', '^', '~'), '', $version); // sha version or branch verison if (preg_match('{^[0-9a-f]{40}$}', $version)) { $version = 'dev-default#' . $version; } elseif ('*' !== $version && !Validator::validateTag($searchVersion, $assetType) && !static::depIsRange($version)) { $oldVersion = $version; $version = 'dev-' . $assetType->getVersionConverter()->convertVersion($version); if (!Validator::validateBranch($oldVersion)) { $version .= ' || ' . $oldVersion; } } return array($dependency, $version); }