Skip to content

Commit b5a5ca3

Browse files
Nyholmdbu
authored andcommitted
Start version 2
1 parent 04d4829 commit b5a5ca3

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ cache:
77
- $HOME/.composer/cache/files
88

99
php:
10-
- 5.5
11-
- 5.6
12-
- 7.0
1310
- 7.1
1411
- 7.2
1512
- 7.3

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.2.0 - unreleased
410

511
### Added

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^5.5 || ^7.0",
15-
"php-http/httplug": "^1.0 || ^2.0",
16-
"php-http/client-common": "^1.9 || ^2.0",
14+
"php": "^7.1",
15+
"php-http/httplug": "^2.0",
16+
"php-http/client-common": "^2.0",
1717
"php-http/discovery": "^1.0",
1818
"php-http/message-factory": "^1.0"
1919
},
@@ -36,7 +36,7 @@
3636
},
3737
"extra": {
3838
"branch-alias": {
39-
"dev-master": "1.2-dev"
39+
"dev-master": "2.0-dev"
4040
}
4141
},
4242
"prefer-stable": true,

spec/ClientSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ function it_returns_the_last_request(RequestInterface $request, ResponseInterfac
8080
$this->getLastRequest()->shouldReturn($request);
8181
}
8282

83-
function it_returns_false_when_there_is_no_last_request()
83+
function it_returns_null_when_there_is_no_last_request()
8484
{
85-
$this->getLastRequest()->shouldReturn(false);
85+
$this->getLastRequest()->shouldReturn(null);
8686
}
8787
}

src/Client.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function addException(\Exception $exception)
100100
*
101101
* If both a default exception and a default response are set, the exception will be thrown.
102102
*/
103-
public function setDefaultException(\Exception $defaultException = null)
103+
public function setDefaultException(?\Exception $defaultException)
104104
{
105105
$this->defaultException = $defaultException;
106106
}
@@ -116,7 +116,7 @@ public function addResponse(ResponseInterface $response)
116116
/**
117117
* Sets the default response to be returned when the list of added exceptions and responses is exhausted.
118118
*/
119-
public function setDefaultResponse(ResponseInterface $defaultResponse = null)
119+
public function setDefaultResponse(?ResponseInterface $defaultResponse)
120120
{
121121
$this->defaultResponse = $defaultResponse;
122122
}
@@ -126,13 +126,13 @@ public function setDefaultResponse(ResponseInterface $defaultResponse = null)
126126
*
127127
* @return RequestInterface[]
128128
*/
129-
public function getRequests()
129+
public function getRequests(): array
130130
{
131131
return $this->requests;
132132
}
133133

134-
public function getLastRequest()
134+
public function getLastRequest(): ?RequestInterface
135135
{
136-
return end($this->requests);
136+
return end($this->requests) ?: null;
137137
}
138138
}

0 commit comments

Comments
 (0)