Enable strict exception type hint checking in PHPStan and add exception type hints

This commit is contained in:
Alex Cabal 2024-05-10 20:47:36 -05:00
parent 559e4a5e05
commit c4c8e7353f
26 changed files with 300 additions and 82 deletions

View file

@ -6,8 +6,16 @@ class GitCommit{
public string $Message;
public string $Hash;
/**
* @throws Exceptions\InvalidGitCommitException
*/
public function __construct(string $unixTimestamp, string $hash, string $message){
$this->Created = new DateTimeImmutable('@' . $unixTimestamp);
try{
$this->Created = new DateTimeImmutable('@' . $unixTimestamp);
}
catch(\Exception){
throw new Exceptions\InvalidGitCommitException('Invalid timestamp for Git commit.');
}
$this->Message = $message;
$this->Hash = $hash;
}