public function getMostRecentTag(string $gitDirectory): ?string
    {
        $command = ['git', 'tag', '-l', '--sort=committerdate'];

        if (getcwd() !== $gitDirectory) {
            $command[] = '--git-dir';
            $command[] = $gitDirectory;
        }

        $tags = $this->processRunner->run($command);
        $tagList = explode(PHP_EOL, trim($tags));

        /** @var string $theMostRecentTag */
        $theMostRecentTag = array_pop($tagList);

        if (empty($theMostRecentTag)) {
            return null;
        }

        return $theMostRecentTag;
    }
public function getMostRecentTag(string $gitDirectory): ?string
    {
        $command = ['git', 'tag', '-l', '--sort=committerdate'];

        if (getcwd() !== $gitDirectory) {
            $command[] = '--git-dir';
            $command[] = $gitDirectory;
        }

        $tags = $this->processRunner->run($command);
        $tagList = explode(PHP_EOL, trim($tags));

        /** @var string $theMostRecentTag */
        $theMostRecentTag = array_pop($tagList);

        if (empty($theMostRecentTag)) {
            return null;
        }

        return $theMostRecentTag;
    }
public function getMostRecentTag ( string $ gitDirectory ) : ? string { $ command = [ 'git' , 'tag' , '-l' , '--sort=committerdate' ] ; if ( getcwd ( ) !== $ gitDirectory ) { $ command [ ] = '--git-dir' ; $ command [ ] = $ gitDirectory ; } $ tags = $ this -> processRunner -> run ( $ command ) ; $ tagList = explode ( PHP_EOL , trim ( $ tags ) ) ; /** @var string $theMostRecentTag */ $ theMostRecentTag = array_pop ( $ tagList ) ; if ( empty ( $ theMostRecentTag ) ) { return null ; } return $ theMostRecentTag ; }
Returns null, when there are no local tags yet
Returns null when there are no local tags yet