From e34ec33199e281e7e83fdebac67652a6a877a3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 2 Dec 2021 15:38:42 +0100 Subject: [PATCH] Avoid assignment in if clause MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Image.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index bbed6e6f671..9e754f57b76 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -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; } /**