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

Commit 90bc832

Browse files
committed
Merge branch 'hotfix/94'
Close #94
2 parents 392dd21 + ffaa9e7 commit 90bc832

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CHANGELOG.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file, in reverse
44

55
Releases prior to 1.2.0 did not have entries.
66

7-
## 1.3.1 - TBD
7+
## 1.3.1 - 2018-09-17
88

99
### Added
1010

@@ -24,7 +24,11 @@ Releases prior to 1.2.0 did not have entries.
2424

2525
### Fixed
2626

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

2933
## 1.3.0 - 2018-07-30
3034

src/Result/AbstractResult.php

+5-7
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

+1-1
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)