File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -71,17 +71,17 @@ public function __toString() : string
7171 */
7272 public function setVersion (string $ version ) : self
7373 {
74- $ semverRegex = '/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+)?)?$/ ' ;
74+ $ semverRegex = '/^v?(?<major> \d+)\.(?<minor> \d+)\.(?<patch> \d+)(?:-(?<pre_release> [0-9A-Za-z-.]+))?(?:\+(?<build> [0-9A-Za-z-.]+)?)?$/ ' ;
7575
7676 if (! preg_match ($ semverRegex , $ version , $ matches )) {
7777 throw new InvalidVersionException ('Invalid Semantic Version string provided ' );
7878 }
7979
80- $ this ->major = (int ) $ matches [1 ];
81- $ this ->minor = (int ) $ matches [2 ];
82- $ this ->patch = (int ) $ matches [3 ];
83- $ this ->preRelease = $ matches [4 ] ?? null ;
84- $ this ->build = $ matches [5 ] ?? null ;
80+ $ this ->major = (int ) $ matches [' major ' ];
81+ $ this ->minor = (int ) $ matches [' minor ' ];
82+ $ this ->patch = (int ) $ matches [' patch ' ];
83+ $ this ->preRelease = $ matches [' pre_release ' ] ?? null ;
84+ $ this ->build = $ matches [' build ' ] ?? null ;
8585
8686 return $ this ;
8787 }
You can’t perform that action at this time.
0 commit comments