Fix typing problems in OC_Image

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/30117/head
Côme Chilliet 2021-12-02 11:30:10 +07:00
parent 3f10cf8996
commit 07997131d3
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
2 changed files with 11 additions and 3 deletions

@ -125,7 +125,11 @@ class OC_Image implements \OCP\IImage {
* @return int
*/
public function width() {
return $this->valid() ? imagesx($this->resource) : -1;
if ($this->valid() && (($width = imagesx($this->resource)) !== false)) {
return $width;
} else {
return -1;
}
}
/**
@ -134,7 +138,11 @@ class OC_Image implements \OCP\IImage {
* @return int
*/
public function height() {
return $this->valid() ? imagesy($this->resource) : -1;
if ($this->valid() && (($height = imagesy($this->resource)) !== false)) {
return $height;
} else {
return -1;
}
}
/**

@ -99,7 +99,7 @@ interface IImage {
public function save($filePath = null, $mimeType = null);
/**
* @return resource|\GdImage Returns the image resource in any.
* @return false|resource|\GdImage Returns the image resource if any
* @since 8.1.0
*/
public function resource();