Skip to content

Commit cb0c797

Browse files
committed
Merge pull request #27 from Ricca-Group/master
fixed #27 for php 5.4 or above.
2 parents 2aea25a + fbace7b commit cb0c797

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Issue/Reporter.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ 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+
if(empty($vars)) {
36+
return null;
37+
}
38+
return $vars;
3439
}
3540
}

0 commit comments

Comments
 (0)