Skip to content

Commit a022c70

Browse files
committed
Replaces parent for the SemanticVersion.php class to resolve errors with some mac applications.
1 parent 4b52c89 commit a022c70

File tree

2 files changed

+21
-61
lines changed

2 files changed

+21
-61
lines changed

composer.json

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,35 @@
99
"email": "am@jonesiscoding.com"
1010
}
1111
],
12-
"version": "1.7.3",
12+
"version": "1.8",
1313
"autoload": {
1414
"psr-4": {
1515
"DevCoding\\Mac\\": "src"
1616
}
1717
},
18+
"prefer-stable": true,
19+
"minimum-stability": "dev",
20+
"repositories": [
21+
{
22+
"type": "package",
23+
"package": {
24+
"name": "deviscoding/objection",
25+
"version": "dev-master",
26+
"source": {
27+
"url": "https://github.com/deviscoding/objection",
28+
"type": "git",
29+
"reference": "main"
30+
}
31+
}
32+
}
33+
],
1834
"require": {
1935
"php": "^7.0",
2036
"ext-json": "*",
2137
"ext-posix": "*",
2238
"jonesiscoding/base-console": "^4.4",
23-
"phlak/semver": "^3.2",
2439
"symfony/process": "^4.4",
25-
"symfony/yaml": "^4.4"
40+
"symfony/yaml": "^4.4",
41+
"deviscoding/objection": "dev-master"
2642
}
2743
}

src/Objects/SemanticVersion.php

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,17 @@
22

33
namespace DevCoding\Mac\Objects;
44

5-
use PHLAK\SemVer\Version;
5+
use DevCoding\Object\System\Version\Version;
66

77
class SemanticVersion extends Version
88
{
9-
protected $raw;
10-
11-
public function __construct(string $version = '0.1.0')
12-
{
13-
$this->raw = $version;
14-
15-
try
16-
{
17-
parent::__construct($version);
18-
}
19-
catch (\Exception $e)
20-
{
21-
try
22-
{
23-
// Try the built in fixer
24-
$Fix = static::parse($version);
25-
}
26-
catch (\Exception $e)
27-
{
28-
// Too many dots
29-
$v = explode('.', $version);
30-
if (count($v) > 3)
31-
{
32-
$version = array_shift($v) . "." . array_shift($v) . '.' . implode('', $v);
33-
$Fix = static::parse($version);
34-
}
35-
}
36-
37-
$this->setMajor($Fix->major);
38-
$this->setMinor($Fix->minor);
39-
$this->setPatch($Fix->patch);
40-
$this->setPreRelease($Fix->preRelease);
41-
$this->setbuild($Fix->build);
42-
}
43-
}
44-
459
public function getRaw()
4610
{
4711
return $this->raw;
4812
}
4913

50-
public function getBuild()
51-
{
52-
return $this->build;
53-
}
54-
55-
public function getMajor()
56-
{
57-
return $this->major;
58-
}
59-
60-
public function getMinor()
61-
{
62-
return $this->minor;
63-
}
64-
6514
public function getRevision()
6615
{
67-
return $this->patch;
68-
}
69-
70-
public function getPreRelease()
71-
{
72-
return $this->preRelease;
16+
return $this->getPatch();
7317
}
7418
}

0 commit comments

Comments
 (0)