public static function ExtensionVersion::createFromSupportBranch in Drupal 9
Constructs an ExtensionVersion version object from a support branch.
This can be used to determine the major version of the branch. ::getVersionExtra() will always return NULL for branches.
Parameters
string $branch: The support branch.
Return value
\Drupal\Core\Extension\ExtensionVersion The ExtensionVersion instance.
3 calls to ExtensionVersion::createFromSupportBranch()
- ExtensionVersionTest::testCreateFromSupportBranch in core/
tests/ Drupal/ Tests/ Core/ Extension/ ExtensionVersionTest.php - @covers ::createFromSupportBranch
- ExtensionVersionTest::testInvalidBranch in core/
tests/ Drupal/ Tests/ Core/ Extension/ ExtensionVersionTest.php - @covers ::createFromSupportBranch
- ExtensionVersionTest::testInvalidBranchCorePrefix in core/
tests/ Drupal/ Tests/ Core/ Extension/ ExtensionVersionTest.php - @covers ::createFromSupportBranch
File
- core/
lib/ Drupal/ Core/ Extension/ ExtensionVersion.php, line 121
Class
- ExtensionVersion
- Provides an extension version value object.
Namespace
Drupal\Core\ExtensionCode
public static function createFromSupportBranch(string $branch) : ExtensionVersion {
if (substr($branch, -1) !== '.') {
throw new \UnexpectedValueException("Invalid support branch: {$branch}");
}
return static::createFromVersionString($branch . '0');
}