Skip to content

Commit d897520

Browse files
come-ncbackportbot[bot]
authored andcommitted
Avoid assignment in if clause
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent d1e0aee commit d897520

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/private/legacy/OC_Image.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,13 @@ public function mimeType() {
124124
* @return int
125125
*/
126126
public function width() {
127-
if ($this->valid() && (($width = imagesx($this->resource)) !== false)) {
128-
return $width;
129-
} else {
130-
return -1;
127+
if ($this->valid()) {
128+
$width = imagesx($this->resource);
129+
if ($width !== false) {
130+
return $width;
131+
}
131132
}
133+
return -1;
132134
}
133135

134136
/**
@@ -137,11 +139,13 @@ public function width() {
137139
* @return int
138140
*/
139141
public function height() {
140-
if ($this->valid() && (($height = imagesy($this->resource)) !== false)) {
141-
return $height;
142-
} else {
143-
return -1;
142+
if ($this->valid()) {
143+
$height = imagesy($this->resource);
144+
if ($height !== false) {
145+
return $height;
146+
}
144147
}
148+
return -1;
145149
}
146150

147151
/**

0 commit comments

Comments
 (0)