Fix typing problems in OC_Image

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2021-12-02 11:30:10 +01:00 committed by backportbot[bot]
parent 11b51ddbbe
commit 3fe20bfbbb
2 changed files with 11 additions and 3 deletions

View file

@ -124,7 +124,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;
}
}
/**
@ -133,7 +137,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;
}
}
/**

View file

@ -98,7 +98,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();