Skip to content

Commit 131767b

Browse files
authored
Merge pull request #281 from Art4/port-275-to-v2-branch
Port #275 into v2.x
2 parents 887501f + 392b02f commit 131767b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/Redmine/Api/AbstractApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function lastCallFailed()
4242
* @param string $path
4343
* @param bool $decodeIfJson
4444
*
45-
* @return string|array|SimpleXMLElement|null
45+
* @return string|array|SimpleXMLElement|false
4646
*/
4747
protected function get($path, $decodeIfJson = true)
4848
{
@@ -64,7 +64,7 @@ protected function get($path, $decodeIfJson = true)
6464
}
6565
}
6666

67-
return ('' === $body) ? null : $body;
67+
return ('' === $body) ? false : $body;
6868
}
6969

7070
/**

src/Redmine/Api/IssueRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function all($issueId, array $params = [])
4242
public function show($id)
4343
{
4444
$ret = $this->get('/relations/'.urlencode($id).'.json');
45-
if (null === $ret) {
45+
if (false === $ret) {
4646
return [];
4747
}
4848

tests/Unit/Api/AbstractApiTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ public function getJsonDecodingFromGetMethodData()
129129
['{"foo_bar": 12345}', null, ['foo_bar' => 12345]], // test decode by default
130130
['{"foo_bar": 12345}', false, '{"foo_bar": 12345}'],
131131
['{"foo_bar": 12345}', true, ['foo_bar' => 12345]],
132-
['', true, null], // test decode with empty body
132+
'Empty body, JSON decode: false' => ['', false, false],
133+
'Empty body, JSON decode: true' => ['', true, false],
133134
['{"foo_bar":', true, 'Error decoding body as JSON: Syntax error'], // test invalid JSON
134135
];
135136
}

0 commit comments

Comments
 (0)