Avoid assignment in if clause

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2021-12-02 15:38:42 +01:00
parent 07997131d3
commit e34ec33199
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

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