@@ -44,32 +44,32 @@ public static function download(string $remote, string $targetDir): self
4444 return new self (realpath ($ targetDir ));
4545 }
4646
47- public function getPath ()
47+ public function getPath (): string
4848 {
4949 return $ this ->path ;
5050 }
5151
52- public function getUrl ()
52+ public function getUrl (): string
5353 {
5454 return $ this ->getLastLine ($ this ->execInPath ('git config --get remote.origin.url ' ));
5555 }
5656
57- public function getLastCommitHash ()
57+ public function getLastCommitHash (): string
5858 {
5959 return $ this ->getLastLine ($ this ->execInPath ('git log -1 --format="%H" ' ));
6060 }
6161
62- public function getLastAuthor ()
62+ public function getLastAuthor (): string
6363 {
6464 return $ this ->getLastLine ($ this ->execInPath ('git log -1 --format="%an" ' ));
6565 }
6666
67- public function getLastAuthoredDate ()
67+ public function getLastAuthoredDate (): \ DateTime
6868 {
6969 return new \DateTime ($ this ->getLastLine ($ this ->execInPath ('git log -1 --format="%ai" ' )));
7070 }
7171
72- public function getLastTag (callable $ filter = null )
72+ public function getLastTag (callable $ filter = null ): string
7373 {
7474 $ tags = $ this ->execInPath ('git tag -l --sort=v:refname ' );
7575
@@ -80,17 +80,17 @@ public function getLastTag(callable $filter = null)
8080 return $ this ->getLastLine ($ tags );
8181 }
8282
83- public function checkout ($ branch )
83+ public function checkout (string $ branch )
8484 {
8585 $ this ->execInPath (sprintf ('git checkout %s ' , escapeshellarg ($ branch )));
8686 }
8787
88- private function execInPath (string $ command )
88+ private function execInPath (string $ command ): array
8989 {
9090 return self ::exec (sprintf ('cd %s && %s ' , escapeshellarg ($ this ->path ), $ command ));
9191 }
9292
93- private static function exec ($ command , $ customErrorMessage = null )
93+ private static function exec (string $ command , string $ customErrorMessage = null ): array
9494 {
9595 exec (sprintf ('%s 2>&1 ' , $ command ), $ output , $ result );
9696
@@ -101,7 +101,7 @@ private static function exec($command, $customErrorMessage = null)
101101 return $ output ;
102102 }
103103
104- private function getLastLine (array $ output )
104+ private function getLastLine (array $ output ): string
105105 {
106106 return array_pop ($ output );
107107 }
0 commit comments