mirror of
https://github.com/standardebooks/web.git
synced 2025-07-09 16:20:27 -04:00
Update PHPStan and Safe PHP, and review codebase for further type correctness
This commit is contained in:
parent
e2e14a3551
commit
9d1b66d19e
35 changed files with 301 additions and 169 deletions
|
@ -254,7 +254,7 @@ class Artwork{
|
|||
if(!isset($this->Dimensions)){
|
||||
$this->_Dimensions = '';
|
||||
try{
|
||||
list($imageWidth, $imageHeight) = getimagesize($this->ImageFsPath);
|
||||
list($imageWidth, $imageHeight) = (getimagesize($this->ImageFsPath) ?? throw new \Exception());
|
||||
if($imageWidth && $imageHeight){
|
||||
$this->_Dimensions = number_format($imageWidth) . ' × ' . number_format($imageHeight);
|
||||
}
|
||||
|
@ -529,9 +529,14 @@ class Artwork{
|
|||
}
|
||||
|
||||
// Check for minimum dimensions.
|
||||
list($imageWidth, $imageHeight) = getimagesize($imagePath);
|
||||
if(!$imageWidth || !$imageHeight || $imageWidth < ARTWORK_IMAGE_MINIMUM_WIDTH || $imageHeight < ARTWORK_IMAGE_MINIMUM_HEIGHT){
|
||||
$error->Add(new Exceptions\ArtworkImageDimensionsTooSmallException());
|
||||
try{
|
||||
list($imageWidth, $imageHeight) = (getimagesize($imagePath) ?? throw new \Exception());
|
||||
if(!$imageWidth || !$imageHeight || $imageWidth < ARTWORK_IMAGE_MINIMUM_WIDTH || $imageHeight < ARTWORK_IMAGE_MINIMUM_HEIGHT){
|
||||
$error->Add(new Exceptions\ArtworkImageDimensionsTooSmallException());
|
||||
}
|
||||
}
|
||||
catch(\Exception){
|
||||
$error->Add(new Exceptions\InvalidImageUploadException());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +652,7 @@ class Artwork{
|
|||
}
|
||||
|
||||
preg_match('|^/books/edition/[^/]+/([^/]+)$|ius', $parsedUrl['path'], $matches);
|
||||
$id = $matches[1];
|
||||
$id = $matches[1] ?? '';
|
||||
|
||||
parse_str($parsedUrl['query'] ?? '', $vars);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue