Update draft PSR-15 interfaces

This commit is contained in:
PJ Dietz 2017-12-08 16:06:11 -05:00
parent 1dd9bf0f9c
commit 4c40db8ecc
9 changed files with 146 additions and 145 deletions

View File

@ -21,7 +21,7 @@
"autoload": {
"psr-4": {
"WellRESTed\\": "src/",
"Psr\\Http\\ServerMiddleware\\": "src-fig/"
"Psr\\Http\\Server\\": "src-fig/"
}
}
}

230
composer.lock generated
View File

@ -114,37 +114,40 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102"
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"homepage": "https://github.com/myclabs/DeepCopy",
"keywords": [
"clone",
"copy",
@ -152,7 +155,7 @@
"object",
"object graph"
],
"time": "2017-04-12T18:52:22+00:00"
"time": "2017-10-19T19:58:43+00:00"
},
{
"name": "phar-io/manifest",
@ -258,16 +261,16 @@
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
@ -308,33 +311,39 @@
"reflection",
"static analysis"
],
"time": "2015-12-27T11:43:31+00:00"
"time": "2017-09-11T18:02:19+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.2.0",
"version": "4.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "46f7e8bb075036c92695b15a1ddb6971c751e585"
"reference": "66465776cfc249844bde6d117abff1d22e06c2da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/46f7e8bb075036c92695b15a1ddb6971c751e585",
"reference": "46f7e8bb075036c92695b15a1ddb6971c751e585",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da",
"reference": "66465776cfc249844bde6d117abff1d22e06c2da",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0",
"phpdocumentor/type-resolver": "^0.4.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
"doctrine/instantiator": "~1.0.5",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
@ -353,7 +362,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-07-15T11:38:20+00:00"
"time": "2017-11-27T17:38:31+00:00"
},
{
"name": "phpdocumentor/type-resolver",
@ -404,33 +413,33 @@
},
{
"name": "phpspec/prophecy",
"version": "v1.7.0",
"version": "1.7.3",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "93d39f1f7f9326d746203c7c056f300f7f126073"
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073",
"reference": "93d39f1f7f9326d746203c7c056f300f7f126073",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
"reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8 || ^5.6.5"
"phpunit/phpunit": "^4.8.35 || ^5.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
"dev-master": "1.7.x-dev"
}
},
"autoload": {
@ -463,45 +472,44 @@
"spy",
"stub"
],
"time": "2017-03-02T20:05:34+00:00"
"time": "2017-11-24T13:59:53+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "5.2.1",
"version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b"
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/dc421f9ca5082a0c0cb04afb171c765f79add85b",
"reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1",
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^7.0",
"phpunit/php-file-iterator": "^1.3",
"phpunit/php-text-template": "^1.2",
"phpunit/php-token-stream": "^1.4.11 || ^2.0",
"sebastian/code-unit-reverse-lookup": "^1.0",
"phpunit/php-file-iterator": "^1.4.2",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^2.0.1",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.0",
"sebastian/version": "^2.0",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
},
"require-dev": {
"ext-xdebug": "^2.5",
"phpunit/phpunit": "^6.0"
},
"suggest": {
"ext-xdebug": "^2.5.3"
"ext-xdebug": "^2.5.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.2.x-dev"
"dev-master": "5.3.x-dev"
}
},
"autoload": {
@ -516,7 +524,7 @@
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
@ -527,20 +535,20 @@
"testing",
"xunit"
],
"time": "2017-04-21T08:03:57+00:00"
"time": "2017-12-06T09:29:45+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.2",
"version": "1.4.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
"shasum": ""
},
"require": {
@ -574,7 +582,7 @@
"filesystem",
"iterator"
],
"time": "2016-10-03T07:40:28+00:00"
"time": "2017-11-27T13:52:08+00:00"
},
{
"name": "phpunit/php-text-template",
@ -668,29 +676,29 @@
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.11",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7"
"reference": "791198a2c6254db10131eecfe8c06670700904db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
"reference": "791198a2c6254db10131eecfe8c06670700904db",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
"phpunit/phpunit": "^6.2.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
"dev-master": "2.0-dev"
}
},
"autoload": {
@ -713,20 +721,20 @@
"keywords": [
"tokenizer"
],
"time": "2017-02-27T10:12:30+00:00"
"time": "2017-11-27T05:48:46+00:00"
},
{
"name": "phpunit/phpunit",
"version": "6.2.3",
"version": "6.5.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7"
"reference": "882e886cc928a0abd3c61282b2a64026237d14a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa5711d0559fc4b64deba0702be52d41434cbcb7",
"reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/882e886cc928a0abd3c61282b2a64026237d14a4",
"reference": "882e886cc928a0abd3c61282b2a64026237d14a4",
"shasum": ""
},
"require": {
@ -735,24 +743,24 @@
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "^1.3",
"myclabs/deep-copy": "^1.6.1",
"phar-io/manifest": "^1.0.1",
"phar-io/version": "^1.0",
"php": "^7.0",
"phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^5.2",
"phpunit/php-file-iterator": "^1.4",
"phpunit/php-text-template": "^1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "^4.0",
"sebastian/comparator": "^2.0",
"sebastian/diff": "^1.4.3 || ^2.0",
"sebastian/environment": "^3.0.2",
"phpunit/php-code-coverage": "^5.3",
"phpunit/php-file-iterator": "^1.4.3",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^1.0.9",
"phpunit/phpunit-mock-objects": "^5.0.4",
"sebastian/comparator": "^2.1",
"sebastian/diff": "^2.0",
"sebastian/environment": "^3.1",
"sebastian/exporter": "^3.1",
"sebastian/global-state": "^1.1 || ^2.0",
"sebastian/object-enumerator": "^3.0.2",
"sebastian/global-state": "^2.0",
"sebastian/object-enumerator": "^3.0.3",
"sebastian/resource-operations": "^1.0",
"sebastian/version": "^2.0"
"sebastian/version": "^2.0.1"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2",
@ -771,7 +779,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.2.x-dev"
"dev-master": "6.5.x-dev"
}
},
"autoload": {
@ -797,33 +805,33 @@
"testing",
"xunit"
],
"time": "2017-07-03T15:54:24+00:00"
"time": "2017-12-06T09:42:03+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "4.0.2",
"version": "5.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4"
"reference": "16b50f4167e5e85e81ca8a3dd105d0a5fd32009a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4",
"reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/16b50f4167e5e85e81ca8a3dd105d0a5fd32009a",
"reference": "16b50f4167e5e85e81ca8a3dd105d0a5fd32009a",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"doctrine/instantiator": "^1.0.5",
"php": "^7.0",
"phpunit/php-text-template": "^1.2",
"phpunit/php-text-template": "^1.2.1",
"sebastian/exporter": "^3.0"
},
"conflict": {
"phpunit/phpunit": "<6.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^6.5"
},
"suggest": {
"ext-soap": "*"
@ -831,7 +839,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
"dev-master": "5.0.x-dev"
}
},
"autoload": {
@ -846,7 +854,7 @@
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
@ -856,7 +864,7 @@
"mock",
"xunit"
],
"time": "2017-06-30T08:15:21+00:00"
"time": "2017-12-02T05:31:19+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -905,30 +913,30 @@
},
{
"name": "sebastian/comparator",
"version": "2.0.0",
"version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "20f84f468cb67efee293246e6a09619b891f55f0"
"reference": "1174d9018191e93cb9d719edec01257fc05f8158"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/20f84f468cb67efee293246e6a09619b891f55f0",
"reference": "20f84f468cb67efee293246e6a09619b891f55f0",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158",
"reference": "1174d9018191e93cb9d719edec01257fc05f8158",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/diff": "^1.2",
"sebastian/exporter": "^3.0"
"sebastian/diff": "^2.0",
"sebastian/exporter": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.1.x-dev"
}
},
"autoload": {
@ -959,38 +967,38 @@
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-03-03T06:26:08+00:00"
"time": "2017-11-03T07:16:52+00:00"
},
{
"name": "sebastian/diff",
"version": "1.4.3",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
"reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd",
"reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
"phpunit/phpunit": "^6.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
"dev-master": "2.0-dev"
}
},
"autoload": {
@ -1017,7 +1025,7 @@
"keywords": [
"diff"
],
"time": "2017-05-22T07:24:03+00:00"
"time": "2017-08-03T08:09:46+00:00"
},
{
"name": "sebastian/environment",
@ -1189,21 +1197,21 @@
},
{
"name": "sebastian/object-enumerator",
"version": "3.0.2",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8"
"reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/31dd3379d16446c5d86dec32ab1ad1f378581ad8",
"reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5",
"reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/object-reflector": "^1.0",
"sebastian/object-reflector": "^1.1.1",
"sebastian/recursion-context": "^3.0"
},
"require-dev": {
@ -1232,7 +1240,7 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-03-12T15:17:29+00:00"
"time": "2017-08-03T12:35:26+00:00"
},
{
"name": "sebastian/object-reflector",

View File

@ -1,7 +0,0 @@
<?php
namespace Psr\Http\ServerMiddleware;
interface DelegateInterface extends HandleInterface
{
}

View File

@ -1,12 +0,0 @@
<?php
namespace Psr\Http\ServerMiddleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
interface HandleInterface
{
public function __invoke(ServerRequestInterface $request): ResponseInterface;
}

View File

@ -1,6 +1,6 @@
<?php
namespace Psr\Http\ServerMiddleware;
namespace Psr\Http\Server;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@ -9,5 +9,5 @@ interface MiddlewareInterface
{
public function process(
ServerRequestInterface $request,
DelegateInterface $delegate): ResponseInterface;
RequestHandlerInterface $handler): ResponseInterface;
}

View File

@ -0,0 +1,11 @@
<?php
namespace Psr\Http\Server;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
interface RequestHandlerInterface
{
public function handle(ServerRequestInterface $request): ResponseInterface;
}

View File

@ -4,7 +4,8 @@ namespace WellRESTed\Dispatching;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
class Dispatcher implements DispatcherInterface
{
@ -32,6 +33,8 @@ class Dispatcher implements DispatcherInterface
if (is_callable($dispatchable)) {
return $dispatchable($request, $response, $next);
} elseif ($dispatchable instanceof RequestHandlerInterface) {
return $dispatchable->handle($request);
} elseif ($dispatchable instanceof MiddlewareInterface) {
$delegate = new DispatcherDelegate($response, $next);
return $dispatchable->process($request, $delegate);

View File

@ -4,12 +4,12 @@ namespace WellRESTed\Dispatching;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Server\RequestHandlerInterface;
/**
* Adapter to allow use of PSR-15 Middleware with double pass implementations.
*/
class DispatcherDelegate implements DelegateInterface
class DispatcherDelegate implements RequestHandlerInterface
{
/** @var ResponseInterface */
private $response;
@ -22,7 +22,7 @@ class DispatcherDelegate implements DelegateInterface
$this->next = $next;
}
public function __invoke(ServerRequestInterface $request): ResponseInterface
public function handle(ServerRequestInterface $request): ResponseInterface
{
return call_user_func($this->next, $request, $this->response);
}

View File

@ -4,7 +4,7 @@ namespace WellRESTed\Test\Unit\Dispatching;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Server\RequestHandlerInterface;
use WellRESTed\Dispatching\Dispatcher;
use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest;
@ -12,8 +12,6 @@ use WellRESTed\MiddlewareInterface;
use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
use Psr\Http\ServerMiddleware\HandleInterface;
class DispatcherTest extends TestCase
{
/** @var ServerRequestInterface */
@ -185,7 +183,7 @@ class DoublePassMiddlewareDouble implements MiddlewareInterface
/**
* PSR-15 Handler that returns a ResponseInterface stub
*/
class HandlerDouble implements HandleInterface
class HandlerDouble implements RequestHandlerInterface
{
/** @var ResponseInterface */
private $response;
@ -194,7 +192,7 @@ class HandlerDouble implements HandleInterface
$this->response = $response;
}
public function __invoke(ServerRequestInterface $request): ResponseInterface
public function handle(ServerRequestInterface $request): ResponseInterface
{
return $this->response;
}
@ -206,12 +204,12 @@ class HandlerDouble implements HandleInterface
* PSR-15 Middleware that passes the request to the delegate and returns the
* delegate's response
*/
class MiddlewareDouble implements \Psr\Http\ServerMiddleware\MiddlewareInterface
class MiddlewareDouble implements \Psr\Http\Server\MiddlewareInterface
{
public function process(
ServerRequestInterface $request,
DelegateInterface $delegate
RequestHandlerInterface $handler
): ResponseInterface {
return $delegate($request);
return $handler->handle($request);
}
}