From: Côme Chilliet Date: Thu, 2 Dec 2021 14:38:42 +0000 (+0100) Subject: Avoid assignment in if clause X-Git-Tag: v23.0.1rc1~44^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f889b251b1f4d7542cf628c5502548a6620f93d9;p=nextcloud-server.git Avoid assignment in if clause Signed-off-by: Côme Chilliet --- diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 1b1d98325ba..333a9d919ef 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -124,11 +124,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; } /** @@ -137,11 +139,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; } /**