private function getLatestNotMajorUpdateTag($currentTag)
{
$currentTagParsed = $this->parseVersion($currentTag);
$nextVersionParsed = $currentTagParsed;
do {
$nextTag = sprintf('v%d.%d.%d', $nextVersionParsed[0], ++$nextVersionParsed[1], 0);
} while ($this->hasRemoteTag($nextTag));
$nextVersionParsed = $this->parseVersion($nextTag);
--$nextVersionParsed[1];
// check if new minor found, otherwise start looking for new patch from the current patch number
if ($currentTagParsed[1] === $nextVersionParsed[1]) {
$nextVersionParsed[2] = $currentTagParsed[2];
}
do {
$nextTag = sprintf('v%d.%d.%d', $nextVersionParsed[0], $nextVersionParsed[1], ++$nextVersionParsed[2]);
} while ($this->hasRemoteTag($nextTag));
return sprintf('v%d.%d.%d', $nextVersionParsed[0], $nextVersionParsed[1], $nextVersionParsed[2] - 1);
}