Skip to content

Commit 2f0a045

Browse files
authored
Allow Diactoros 1.3 or 2.0 (#88)
1 parent a502c13 commit 2f0a045

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [3.2.1] - 2018-10-24
7+
### Summary
8+
- Widen range of supported Zend Diactoros version
9+
610
## [3.2.0] - 2018-09-19
711
### Summary
812
- Added support for `PATCH` HTTP method

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"psr/http-server-handler": "^1.0",
1010
"psr/http-server-middleware": "^1.0",
1111
"psr/log": "^1.0",
12-
"zendframework/zend-diactoros": "^1.3"
12+
"zendframework/zend-diactoros": "^1.3 || ^2.0"
1313
},
1414
"suggest": {
1515
"firehed/inputobjects": "Pre-made Input components for validation"

src/Dispatcher.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ private function transformRequestToServerRequest(RequestInterface $request): Ser
161161
foreach ($request->getHeaders() as $name => $values) {
162162
$serverRequest = $serverRequest->withHeader($name, $values);
163163
}
164+
// ZD2 hints the return type of withHeader to MessageInterface not SRI
165+
assert($serverRequest instanceof ServerRequestInterface);
164166
return $serverRequest;
165167
}
166168

tests/DispatcherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function testSetRequestReturnsSelf()
9292
{
9393
$d = new Dispatcher();
9494
$req = $this->createMock(RequestInterface::class);
95+
$req->method('getMethod')->willReturn('GET');
9596
$req->method('getHeaders')->willReturn([]);
9697
$req->method('getBody')->willReturn($this->createMock(StreamInterface::class));
9798
$req->method('getUri')->willReturn($this->createMock(UriInterface::class));

0 commit comments

Comments
 (0)