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

@ -1,7 +1,10 @@
<?
use Exceptions\InvalidLoginException;
use Exceptions\PasswordRequiredException;
use Ramsey\Uuid\Uuid;
use Safe\DateTimeImmutable;
use Safe\Exceptions\DatetimeException;
use function Safe\strtotime;
/**
@ -35,6 +38,10 @@ class Session{
// METHODS
// *******
/**
* @throws Exceptions\InvalidLoginException
* @throws Exceptions\PasswordRequiredException
*/
public function Create(?string $email = null, ?string $password = null): void{
try{
$this->User = User::GetIfRegistered($email, $password);
@ -54,6 +61,8 @@ class Session{
else{
$uuid = Uuid::uuid4();
$this->SessionId = $uuid->toString();
/** @throws void */
$this->Created = new DateTimeImmutable();
Db::Query('
INSERT into Sessions (UserId, SessionId, Created)