]> source.dussan.org Git - nextcloud-server.git/commitdiff
Avoid assignment in if clause 30115/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 2 Dec 2021 14:38:42 +0000 (15:38 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 6 Dec 2021 14:22:05 +0000 (14:22 +0000)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/legacy/OC_Image.php

index 1b1d98325baadd1522171bd61be82cd7b54c3cbf..333a9d919efb37ecf17721b1940c16e4076dd42f 100644 (file)
@@ -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;
        }
 
        /**