Style tweaks for getters and add more type hinting

This commit is contained in:
Alex Cabal 2024-04-30 22:45:20 -05:00
parent 9e31ed1aac
commit 50efeb05d1
13 changed files with 87 additions and 84 deletions

View file

@ -34,6 +34,9 @@ class PollItem extends Accessor{
// ORM METHODS
// ***********
/**
* @throws Exceptions\PollNotFoundException
*/
public static function Get(?int $pollItemId): PollItem{
if($pollItemId === null ){
throw new Exceptions\PollItemNotFoundException();
@ -45,10 +48,6 @@ class PollItem extends Accessor{
where PollItemId = ?
', [$pollItemId], 'PollItem');
if(sizeof($result) == 0){
throw new Exceptions\PollItemNotFoundException();
}
return $result[0];
return $result[0] ?? throw new Exceptions\PollItemNotFoundException();
}
}