mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Continue improving type hints
This commit is contained in:
parent
eb376c87bd
commit
703e1a7a03
73 changed files with 98 additions and 114 deletions
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtistNameRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'An artist name is required.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtistNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that artist.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtworkAlreadyExistsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'An artwork with this name already exists.';
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtworkImageDimensionsTooSmallException extends AppException{
|
||||
protected $message;
|
||||
|
||||
// This has to be initialized in a constructor because we use the number_format() function.
|
||||
public function __construct(){
|
||||
$this->message = 'Image dimensions are too small. The minimum image size is ' . number_format(ARTWORK_IMAGE_MINIMUM_WIDTH) . ' × ' . number_format(ARTWORK_IMAGE_MINIMUM_HEIGHT) . '.';
|
||||
|
||||
parent::__construct($this->message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtworkNameRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'An artwork name is required.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class ArtworkNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that artwork.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class DuplicateDatabaseKeyException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'An attempted row insertion has violated the database unique index.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidArtistException extends ValidationException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Artist is invalid.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidArtworkException extends ValidationException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Artwork is invalid.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidArtworkPageUrlException extends InvalidUrlException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid link to page with artwork.';
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidArtworkTagException extends ValidationException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Artwork tag is invalid.';
|
||||
|
||||
public function __construct(?string $tagName){
|
||||
if($tagName !== null && trim($tagName) != ''){
|
||||
$this->message = 'Artwork tag ' . $tagName . ' is invalid.';
|
||||
}
|
||||
|
||||
parent::__construct($this->message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidArtworkTagNameException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Artwork tags can only contain letters and numbers.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidCaptchaException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t validate your CAPTCHA response.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidCompletedYearException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid year of completion.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidCopyrightPageUrlException extends InvalidUrlException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid link to page with copyright details.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidCredentialsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid credentials.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidDeathYearException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid year of death.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidEmailException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t understand your email address.';
|
||||
}
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidImageUploadException extends AppException{
|
||||
public function __construct(?string $message = null){
|
||||
if($message === null){
|
||||
$message = 'Uploaded image is invalid.';
|
||||
}
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
/** @var string $message */
|
||||
protected $message = 'Uploaded image is invalid.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidLoginException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t validate your login information.';
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidMimeTypeException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Uploaded image must be a JPG, BMP, PNG, or TIFF file.';
|
||||
}
|
||||
|
|
|
@ -4,5 +4,7 @@ namespace Exceptions;
|
|||
class InvalidMuseumUrlException extends InvalidUrlException{
|
||||
public function __construct(string $url, string $exampleUrl){
|
||||
$this->message = 'Invalid museum URL: <' . $url . '>. Expected a URL like: <'. $exampleUrl . '>.';
|
||||
|
||||
parent::__construct($this->message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidNewsletterSubscription extends ValidationException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Newsletter subscription is invalid.';
|
||||
}
|
||||
|
|
|
@ -4,5 +4,7 @@ namespace Exceptions;
|
|||
class InvalidPageScanUrlException extends InvalidUrlException{
|
||||
public function __construct(string $url, string $exampleUrl){
|
||||
$this->message = 'Invalid page scan URL: <' . $url . '>. Expected a URL like: <'. $exampleUrl . '>.';
|
||||
|
||||
parent::__construct($this->message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidPermissionsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'You don’t have permission to perform that action.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidPollVoteException extends ValidationException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Vote is invalid.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidPublicationYearException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid year of publication.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidPublicationYearPageUrlException extends InvalidUrlException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid link to page with year of publication.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidRequestException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid HTTP request.';
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class InvalidUrlException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Invalid URL.';
|
||||
|
||||
public function __construct(?string $url = null){
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class MissingEbookException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Artwork marked as “in use”, but the ebook couldn’t be found in the filesystem.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class MissingPdProofException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Missing proof of U.S. public domain status.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class MuseumNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that museum.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class NewsletterRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'You must select at least one newsletter to subscribe to.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class NewsletterSubscriptionExistsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'You’re already subscribed to the newsletter.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class NewsletterSubscriptionNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t find you in our newsletter subscribers list.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PatronNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate you in the Patrons Circle.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PaymentExistsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'This transaction ID already exists.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollClosedException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'This poll is not open to voting right now.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollItemNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that poll item.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollItemRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'You must select an item to vote on.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that poll.';
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollVoteExistsException extends AppException{
|
||||
public $Vote = null;
|
||||
public ?\PollVote $Vote = null;
|
||||
/** @var string $message */
|
||||
protected $message = 'You’ve already voted in this poll.';
|
||||
|
||||
public function __construct(?\PollVote $vote = null){
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class PollVoteNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that vote.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class TagsRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'At least one tag is required.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class TooManyTagsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Too many tags; the maximum is ' . ARTWORK_MAX_TAGS . '.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class UserExistsException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'This email already exists in the database.';
|
||||
}
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class UserNotFoundException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'We couldn’t locate that user.';
|
||||
}
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
/**
|
||||
* @property array<\Exception> $Exceptions
|
||||
*/
|
||||
class ValidationException extends AppException{
|
||||
/** @var array<\Exception> $Exceptions */
|
||||
public $Exceptions = [];
|
||||
public bool $HasExceptions = false;
|
||||
public bool $IsFatal = false;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace Exceptions;
|
||||
|
||||
class WebhookException extends AppException{
|
||||
public $PostData;
|
||||
public ?string $PostData;
|
||||
|
||||
public function __construct(string $message = '', string $data = null){
|
||||
$this->PostData = $data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue