Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 9312e81

Browse files
committed
Merge branch 'hotfix/94' into develop
Forward port #94 Conflicts: CHANGELOG.md
2 parents abf558b + ffaa9e7 commit 9312e81

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Releases prior to 1.2.0 did not have entries.
2626

2727
- Nothing.
2828

29-
## 1.3.1 - TBD
29+
## 1.3.1 - 2018-09-17
3030

3131
### Added
3232

@@ -46,7 +46,11 @@ Releases prior to 1.2.0 did not have entries.
4646

4747
### Fixed
4848

49-
- Nothing.
49+
- [#94](https://github.com/zendframework/zenddiagnostics/pull/94) updates the
50+
`AbstractResult::$message` property to default to an empty string instead of
51+
`null`. Since both `ResultInterface` and `AbstractResult` document that the
52+
return type for `getMessage()` is a string, and all reporters expect a string,
53+
this ensures type safety for the method.
5054

5155
## 1.3.0 - 2018-07-30
5256

src/Result/AbstractResult.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
abstract class AbstractResult implements ResultInterface
1414
{
1515
/**
16-
* @var string|null
16+
* @var string
1717
*/
1818
protected $message;
1919

@@ -25,14 +25,12 @@ abstract class AbstractResult implements ResultInterface
2525
/**
2626
* Create new result
2727
*
28-
* @param string|null $message
28+
* @param string $message
2929
* @param mixed|null $data
3030
*/
31-
public function __construct($message = null, $data = null)
31+
public function __construct($message = '', $data = null)
3232
{
33-
if ($message !== null) {
34-
$this->setMessage($message);
35-
}
33+
$this->setMessage($message);
3634

3735
if ($data !== null) {
3836
$this->setData($data);
@@ -68,7 +66,7 @@ public function setData($data)
6866
}
6967

7068
/**
71-
* @param null|string $message
69+
* @param string $message
7270
*/
7371
public function setMessage($message)
7472
{

test/BasicClassesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testConstructor()
7777
public function testSetters()
7878
{
7979
$result = new Success();
80-
$this->assertSame(null, $result->getMessage());
80+
$this->assertSame('', $result->getMessage());
8181
$this->assertSame(null, $result->getData());
8282

8383
$result->setMessage('foo');

0 commit comments

Comments
 (0)