@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly ProcessRunner $processRunner |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly TagParserInterface $parser, |
| 15 | 15 | private ?string $gitDirectory = null |
| 16 | - ) { |
|
| 17 | - if ($gitDirectory === null) { |
|
| 16 | + ){ |
|
| 17 | + if ($gitDirectory === null){ |
|
| 18 | 18 | $this->gitDirectory = \dirname(__DIR__); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | $mostRecentVersion = $this->findMostRecentVersion($version); |
| 33 | 33 | |
| 34 | 34 | // no tag yet |
| 35 | - if ($mostRecentVersion === null) { |
|
| 35 | + if ($mostRecentVersion === null){ |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // validation |
| 40 | 40 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
| 41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
| 41 | + if ($version->isGreaterThan($mostRecentVersion)){ |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | private function findMostRecentVersion(Version $version): ?string |
| 53 | 53 | { |
| 54 | 54 | $tags = []; |
| 55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
| 55 | + foreach ($this->parser->parse($this->gitDirectory) as $tag){ |
|
| 56 | 56 | $tag = new Version(\strtolower($tag)); |
| 57 | 57 | |
| 58 | 58 | // all previous major versions |
| 59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
| 59 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()){ |
|
| 60 | 60 | $tags[] = $tag; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // all minor versions up to the requested in the requested major version |
| 64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
| 65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
| 64 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()){ |
|
| 65 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()){ |
|
| 66 | 66 | $tags[] = $tag; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if ($tags === []) { |
|
| 71 | + if ($tags === []){ |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -14,7 +14,8 @@ discard block |
||
| 14 | 14 | private readonly TagParserInterface $parser, |
| 15 | 15 | private ?string $gitDirectory = null |
| 16 | 16 | ) { |
| 17 | - if ($gitDirectory === null) { |
|
| 17 | + if ($gitDirectory === null) |
|
| 18 | + { |
|
| 18 | 19 | $this->gitDirectory = \dirname(__DIR__); |
| 19 | 20 | } |
| 20 | 21 | } |
@@ -32,13 +33,15 @@ discard block |
||
| 32 | 33 | $mostRecentVersion = $this->findMostRecentVersion($version); |
| 33 | 34 | |
| 34 | 35 | // no tag yet |
| 35 | - if ($mostRecentVersion === null) { |
|
| 36 | + if ($mostRecentVersion === null) |
|
| 37 | + { |
|
| 36 | 38 | return; |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | // validation |
| 40 | 42 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
| 41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
| 43 | + if ($version->isGreaterThan($mostRecentVersion)) |
|
| 44 | + { |
|
| 42 | 45 | return; |
| 43 | 46 | } |
| 44 | 47 | |
@@ -52,23 +55,28 @@ discard block |
||
| 52 | 55 | private function findMostRecentVersion(Version $version): ?string |
| 53 | 56 | { |
| 54 | 57 | $tags = []; |
| 55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
| 58 | + foreach ($this->parser->parse($this->gitDirectory) as $tag) |
|
| 59 | + { |
|
| 56 | 60 | $tag = new Version(\strtolower($tag)); |
| 57 | 61 | |
| 58 | 62 | // all previous major versions |
| 59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
| 63 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) |
|
| 64 | + { |
|
| 60 | 65 | $tags[] = $tag; |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | 68 | // all minor versions up to the requested in the requested major version |
| 64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
| 65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
| 69 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) |
|
| 70 | + { |
|
| 71 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) |
|
| 72 | + { |
|
| 66 | 73 | $tags[] = $tag; |
| 67 | 74 | } |
| 68 | 75 | } |
| 69 | 76 | } |
| 70 | 77 | |
| 71 | - if ($tags === []) { |
|
| 78 | + if ($tags === []) |
|
| 79 | + { |
|
| 72 | 80 | return null; |
| 73 | 81 | } |
| 74 | 82 | |