mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 06:40:33 -04:00
Enable strict exception type hint checking in PHPStan and add exception type hints
This commit is contained in:
parent
559e4a5e05
commit
c4c8e7353f
26 changed files with 300 additions and 82 deletions
|
@ -1,4 +1,6 @@
|
|||
<?
|
||||
|
||||
use Exceptions\UserExistsException;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Safe\DateTimeImmutable;
|
||||
|
||||
|
@ -77,9 +79,14 @@ class User{
|
|||
// METHODS
|
||||
// *******
|
||||
|
||||
/**
|
||||
* @throws UserExistsException
|
||||
*/
|
||||
public function Create(?string $password = null): void{
|
||||
$uuid = Uuid::uuid4();
|
||||
$this->Uuid = $uuid->toString();
|
||||
|
||||
/** @throws void */
|
||||
$this->Created = new DateTimeImmutable();
|
||||
|
||||
$this->PasswordHash = null;
|
||||
|
@ -145,6 +152,7 @@ class User{
|
|||
|
||||
/**
|
||||
* @throws Exceptions\UserNotFoundException
|
||||
* @throws Exceptions\PasswordRequiredException
|
||||
*/
|
||||
public static function GetIfRegistered(?string $identifier, ?string $password = null): User{
|
||||
// We consider a user "registered" if they have a row in the Benefits table.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue