Skip to content

Commit 3f6d430

Browse files
Nyholmdbu
authored andcommitted
Start version 2
1 parent a797c2a commit 3f6d430

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 2.0.0 - unreleased
4+
5+
### Changed
6+
7+
- Client::getLastRequest returns `null` instead of `false` when on requests have been recorded yet.
8+
39
## 1.5.0 - 2021-08-25
410

511
### Changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"extra": {
4141
"branch-alias": {
42-
"dev-master": "1.x-dev"
42+
"dev-master": "2.x-dev"
4343
}
4444
},
4545
"autoload": {

Diff for: spec/ClientSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ function it_returns_the_last_request(RequestInterface $request, ResponseInterfac
8282
$this->getLastRequest()->shouldReturn($request);
8383
}
8484

85-
function it_returns_false_when_there_is_no_last_request()
85+
function it_returns_null_when_there_is_no_last_request()
8686
{
87-
$this->getLastRequest()->shouldReturn(false);
87+
$this->getLastRequest()->shouldReturn(null);
8888
}
8989

9090
function it_reset(

Diff for: src/Client.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function addException(\Exception $exception)
188188
*
189189
* If both a default exception and a default response are set, the exception will be thrown.
190190
*/
191-
public function setDefaultException(\Exception $defaultException = null)
191+
public function setDefaultException(?\Exception $defaultException)
192192
{
193193
if (null !== $defaultException && !$defaultException instanceof Exception) {
194194
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($defaultException).' will not be possible anymore in the future', E_USER_DEPRECATED);
@@ -207,7 +207,7 @@ public function addResponse(ResponseInterface $response)
207207
/**
208208
* Sets the default response to be returned when the list of added exceptions and responses is exhausted.
209209
*/
210-
public function setDefaultResponse(ResponseInterface $defaultResponse = null)
210+
public function setDefaultResponse(?ResponseInterface $defaultResponse)
211211
{
212212
$this->defaultResponse = $defaultResponse;
213213
}
@@ -217,14 +217,14 @@ public function setDefaultResponse(ResponseInterface $defaultResponse = null)
217217
*
218218
* @return RequestInterface[]
219219
*/
220-
public function getRequests()
220+
public function getRequests(): array
221221
{
222222
return $this->requests;
223223
}
224224

225-
public function getLastRequest()
225+
public function getLastRequest(): ?RequestInterface
226226
{
227-
return end($this->requests);
227+
return end($this->requests) ?: null;
228228
}
229229

230230
public function reset()

0 commit comments

Comments
 (0)