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,4 +1,7 @@
<?
use Exceptions\UserExistsException;
use Exceptions\PaymentExistsException;
use Safe\DateTimeImmutable;
/**
@ -23,6 +26,9 @@ class Payment{
// METHODS
// *******
/**
* @throws Exceptions\PaymentExistsException
*/
public function Create(): void{
if($this->UserId === null){
// Check if we have to create a new user in the database
@ -45,7 +51,13 @@ class Payment{
}
catch(Exceptions\UserNotFoundException){
// User doesn't exist, create it now
$this->User->Create();
try{
$this->User->Create();
}
catch(Exceptions\UserExistsException){
// User already exists, pass
}
}
$this->UserId = $this->User->UserId;