Skip to content

Commit b774a7a

Browse files
committed
Update Reporter.php
More PHP < 5.6 compatible filter
1 parent 2aea25a commit b774a7a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Issue/Reporter.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ class Reporter implements \JsonSerializable
2424

2525
public function jsonSerialize()
2626
{
27-
return array_filter(get_object_vars($this), function ($value, $key) {
28-
// allow empty assignee. See https://github.com/lesstif/php-jira-rest-client/issues/18
27+
$vars = (get_object_vars($this));
28+
foreach($vars as $key => $value) {
2929
if ($key === 'name' && !is_null($value)) {
30-
return true;
30+
continue;
31+
}elseif(is_null($value) || $value === '') {
32+
unset($vars[$key]);
3133
}
32-
return !empty($value);
33-
}, ARRAY_FILTER_USE_BOTH);
34+
}
35+
return $vars;
3436
}
3537
}

0 commit comments

Comments
 (0)