Skip to content

Commit e34ec33

Browse files
committed
Avoid assignment in if clause
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 0799713 commit e34ec33

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
@@ -125,11 +125,13 @@ public function mimeType() {
125125
* @return int
126126
*/
127127
public function width() {
128-
if ($this->valid() && (($width = imagesx($this->resource)) !== false)) {
129-
return $width;
130-
} else {
131-
return -1;
128+
if ($this->valid()) {
129+
$width = imagesx($this->resource);
130+
if ($width !== false) {
131+
return $width;
132+
}
132133
}
134+
return -1;
133135
}
134136

135137
/**
@@ -138,11 +140,13 @@ public function width() {
138140
* @return int
139141
*/
140142
public function height() {
141-
if ($this->valid() && (($height = imagesy($this->resource)) !== false)) {
142-
return $height;
143-
} else {
144-
return -1;
143+
if ($this->valid()) {
144+
$height = imagesy($this->resource);
145+
if ($height !== false) {
146+
return $height;
147+
}
145148
}
149+
return -1;
146150
}
147151

148152
/**

0 commit comments

Comments
 (0)