mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Workaround a bug in Safe-PHP causes PHPStan errors
This commit is contained in:
parent
72d679a04f
commit
5c69923176
3 changed files with 7 additions and 10 deletions
|
@ -581,11 +581,12 @@ class Ebook{
|
||||||
// *******
|
// *******
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
|
||||||
* @throws \Exceptions\ValidationException
|
* @throws \Exceptions\ValidationException
|
||||||
*/
|
*/
|
||||||
public function Validate(): void{
|
public function Validate(): void{
|
||||||
|
/** @throws void */
|
||||||
$now = new DateTimeImmutable();
|
$now = new DateTimeImmutable();
|
||||||
|
|
||||||
$error = new Exceptions\ValidationException();
|
$error = new Exceptions\ValidationException();
|
||||||
|
|
||||||
if($this->Identifier == ''){
|
if($this->Identifier == ''){
|
||||||
|
@ -744,7 +745,7 @@ class Ebook{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exceptions\ValidationException
|
||||||
*/
|
*/
|
||||||
public function CreateOrUpdate(): void{
|
public function CreateOrUpdate(): void{
|
||||||
try{
|
try{
|
||||||
|
@ -1103,7 +1104,7 @@ class Ebook{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exceptions\ValidationException
|
||||||
*/
|
*/
|
||||||
public function Create(): void{
|
public function Create(): void{
|
||||||
$this->Validate();
|
$this->Validate();
|
||||||
|
@ -1157,7 +1158,7 @@ class Ebook{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exceptions\ValidationException
|
||||||
*/
|
*/
|
||||||
public function Save(): void{
|
public function Save(): void{
|
||||||
$this->Validate();
|
$this->Validate();
|
||||||
|
|
|
@ -7,10 +7,8 @@ class InvalidEbookCreatedDatetimeException extends AppException{
|
||||||
/** @var string $message */
|
/** @var string $message */
|
||||||
protected $message = 'Invalid EbookCreated datetime.';
|
protected $message = 'Invalid EbookCreated datetime.';
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function __construct(DateTimeImmutable $createdDatetime){
|
public function __construct(DateTimeImmutable $createdDatetime){
|
||||||
|
/** @throws void */
|
||||||
$now = new DateTimeImmutable();
|
$now = new DateTimeImmutable();
|
||||||
$this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
|
$this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,8 @@ class InvalidEbookUpdatedDatetimeException extends AppException{
|
||||||
/** @var string $message */
|
/** @var string $message */
|
||||||
protected $message = 'Invalid EbookUpdated datetime.';
|
protected $message = 'Invalid EbookUpdated datetime.';
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function __construct(DateTimeImmutable $updatedDatetime){
|
public function __construct(DateTimeImmutable $updatedDatetime){
|
||||||
|
/** @throws void */
|
||||||
$now = new DateTimeImmutable();
|
$now = new DateTimeImmutable();
|
||||||
$this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
|
$this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue