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

Commit

Permalink
Merge branch 'hotfix/94'
Browse files Browse the repository at this point in the history
Close #94
  • Loading branch information
weierophinney committed Sep 17, 2018
2 parents 392dd21 + ffaa9e7 commit 90bc832
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file, in reverse

Releases prior to 1.2.0 did not have entries.

## 1.3.1 - TBD
## 1.3.1 - 2018-09-17

### Added

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

### Fixed

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

## 1.3.0 - 2018-07-30

Expand Down
12 changes: 5 additions & 7 deletions src/Result/AbstractResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
abstract class AbstractResult implements ResultInterface
{
/**
* @var string|null
* @var string
*/
protected $message;

Expand All @@ -25,14 +25,12 @@ abstract class AbstractResult implements ResultInterface
/**
* Create new result
*
* @param string|null $message
* @param string $message
* @param mixed|null $data
*/
public function __construct($message = null, $data = null)
public function __construct($message = '', $data = null)
{
if ($message !== null) {
$this->setMessage($message);
}
$this->setMessage($message);

if ($data !== null) {
$this->setData($data);
Expand Down Expand Up @@ -68,7 +66,7 @@ public function setData($data)
}

/**
* @param null|string $message
* @param string $message
*/
public function setMessage($message)
{
Expand Down
2 changes: 1 addition & 1 deletion test/BasicClassesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testConstructor()
public function testSetters()
{
$result = new Success();
$this->assertSame(null, $result->getMessage());
$this->assertSame('', $result->getMessage());
$this->assertSame(null, $result->getData());

$result->setMessage('foo');
Expand Down

0 comments on commit 90bc832

Please sign in to comment.