/** * Return the last created tag * * @throws \LogicException * @throws \RuntimeException * @throws \InvalidArgumentException * @return Tag|null */ public function getLastTag() { $finder = Finder::create()->files()->in(sprintf('%s/.git/refs/tags', $this->path))->sortByChangedTime(); if ($finder->count() == 0) { return null; } $files = iterator_to_array($finder->getIterator(), false); $files = array_reverse($files); /** @var $firstFile SplFileInfo */ $firstFile = $files[0]; $tagName = $firstFile->getFilename(); return Tag::pick($this, $tagName); }