Skip to content

Commit c6844ea

Browse files
committed
Update doc comments
1 parent 1171549 commit c6844ea

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Version.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,14 @@ public static function minVersion(): Version
173173
}
174174

175175
/**
176-
* Parses a new version from the given version string.
176+
* Parses the given string as a Version and returns the result or null
177+
* if the string is not a valid representation of a semantic version.
178+
*
179+
* Strict mode is on by default, which means partial versions (e.g. '1.0' or '1') and versions with 'v' prefix
180+
* are considered invalid. This behaviour can be turned off by setting the strict parameter to false.
177181
*
178182
* @param string $versionString The version string.
183+
* @param bool $strict Enables or disables strict parsing.
179184
* @return Version|null The parsed version, or null if the parse fails.
180185
*/
181186
public static function parseOrNull(string $versionString, bool $strict = true): ?Version
@@ -188,9 +193,14 @@ public static function parseOrNull(string $versionString, bool $strict = true):
188193
}
189194

190195
/**
191-
* Parses a new version from the given version string.
196+
* Parses the given string as a Version and returns the result or throws a SemverException
197+
* if the string is not a valid representation of a semantic version.
198+
*
199+
* Strict mode is on by default, which means partial versions (e.g. '1.0' or '1') and versions with 'v' prefix
200+
* are considered invalid. This behaviour can be turned off by setting the strict parameter to false.
192201
*
193202
* @param string $versionString The version string.
203+
* @param bool $strict Enables or disables strict parsing.
194204
* @return Version The parsed version.
195205
* @throws SemverException When the given version string is invalid.
196206
*/
@@ -240,7 +250,8 @@ public static function parse(string $versionString, bool $strict = true): Versio
240250
}
241251

242252
/**
243-
* Creates a new version.
253+
* Constructs a semantic version from the given arguments following the pattern:
254+
* <[major]>.<[minor]>.<[patch]>-<[preRelease]>+<[buildMetadata]>
244255
*
245256
* @param int $major The major version number.
246257
* @param int $minor The minor version number.

0 commit comments

Comments
 (0)